Skip to content

Commit

Permalink
implements plotly.Stream 'connected' property
Browse files Browse the repository at this point in the history
- Stream.connected was always false before.  Now it
actually returns the state of the underlying connection
  • Loading branch information
Richard Bryan committed Sep 2, 2016
1 parent 1a1d762 commit ba5b8f1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion plotly/plotly/plotly.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
"""
Expand Down

0 comments on commit ba5b8f1

Please sign in to comment.