Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pysensorbee/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,12 @@ def close(self, **kwargs):
"""
self._app.close(**kwargs)

def is_open(self):
"""
Returns if the connection is established.
"""
return self._open

def get_error(self):
"""
Returns the last error occurred.
Expand Down
3 changes: 3 additions & 0 deletions pysensorbee/test/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ def test_wsquery(self):
wsc = api.wsquery(self.TOPOLOGY)
wsc.start()
try:
# Ensure that the connection is open.
self.assertTrue(wsc.is_open())

# One-shot
wsc._test_oneshot = False
def callback_1(wsc2, rid, type, payload):
Expand Down