From ba5b8f14da45b182d29d752ab2ea4000d6416942 Mon Sep 17 00:00:00 2001 From: Richard Bryan Date: Fri, 2 Sep 2016 11:13:44 -0400 Subject: [PATCH] implements plotly.Stream 'connected' property - Stream.connected was always false before. Now it actually returns the state of the underlying connection --- plotly/plotly/plotly.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plotly/plotly/plotly.py b/plotly/plotly/plotly.py index a1069f8c506..a0243cbe9ec 100644 --- a/plotly/plotly/plotly.py +++ b/plotly/plotly/plotly.py @@ -454,7 +454,6 @@ def __init__(self, stream_id): """ self.stream_id = stream_id - self.connected = False self._stream = None def get_streaming_specs(self): @@ -500,6 +499,13 @@ def heartbeat(self, reconnect_on=(200, '', 408)): "cannot write to a closed connection. " "Call `open()` on the stream to open the stream." ) + + @property + def connected(self): + if self._stream is None: + return False + + return self._stream._isconnected() def open(self): """