Skip to content

Commit

Permalink
Fixes for reconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
tribal-tec committed Jul 24, 2018
1 parent c889e2b commit 541d499
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion python/brayns/api_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ def function(self):
has_value = value.data
else:
has_value = value.as_dict()
if not has_value:
if not has_value or not target_object.connected():
status = utils.http_request(HTTP_METHOD_GET, self.url(), property_name)
if status.code == HTTP_STATUS_OK:
if property_type == 'array':
Expand Down
2 changes: 2 additions & 0 deletions python/brayns/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ def function_builder():
"""Wrapper for returning the animation_slider() function."""
def animation_slider():
""".Show slider to control animation"""
self._setup_websocket()

# pylint: disable=F0401,E1101
import ipywidgets as widgets
from IPython.display import display
Expand Down
4 changes: 4 additions & 0 deletions python/brayns/rpcclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ def url(self):
"""
return self._url

def connected(self):
"""Returns true if the websocket is connected to the remote Brayns instance."""
return self._ws_connected

def request(self, method, params=None, response_timeout=5): # pragma: no cover
"""
Invoke an RPC on the remote running Brayns instance and wait for its reponse.
Expand Down
2 changes: 1 addition & 1 deletion python/brayns/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def http_request(method, url, command, body=None, query_params=None): # pragma:
"""
full_url = url
request = None
full_url = full_url + command
full_url += command
try:
if method == HTTP_METHOD_POST:
if body == '':
Expand Down

0 comments on commit 541d499

Please sign in to comment.