Skip to content

Commit

Permalink
Merge pull request #561 from rabryan/master
Browse files Browse the repository at this point in the history
implements plotly.Stream 'connected' property
  • Loading branch information
jackparmer authored Oct 21, 2016
2 parents fe1f76e + ba5b8f1 commit 3434aeb
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 3434aeb

Please sign in to comment.