Skip to content

Commit

Permalink
solved web socket reconnection issue
Browse files Browse the repository at this point in the history
  • Loading branch information
vesellov committed Dec 29, 2024
1 parent c35661a commit 358abb5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/components/main_win.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ def populate_bottom_toolbar_icon(self, icon_name, state):
def populate_device_server_code_display_dialog(self, event_data):
if _Debug:
print('MainWin.populate_device_server_code_display_dialog', event_data)
if self.device_server_code_display_dialog:
self.device_server_code_display_dialog.dismiss()
self.device_server_code_display_dialog = None
server_code = event_data['server_code']
self.device_server_code_display_dialog = dialogs.open_message_dialog(
title='Authorization code',
Expand Down
1 change: 1 addition & 0 deletions src/screens/screen_device_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ def on_enter(self, *args):
print('DeviceConnectScreen.on_enter', args)
if system.is_android():
self.ids.selection_tabs.ids.carousel.slides[0].ids.local_device_button.disabled = True
self.ids.selection_tabs.switch_tab('Remote', search_by='title')

def on_leave(self, *args):
if _Debug:
Expand Down
11 changes: 10 additions & 1 deletion src/screens/screen_device_disconnected.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,16 @@ def do_open_device_connect_screen(self):

def do_connect(self, interval=None):
if _Debug:
print('DeviceDisconnectedScreen.do_connect', self.counter)
print('DeviceDisconnectedScreen.do_connect')
if web_sock_remote.is_started():
web_sock_remote.stop()
Clock.schedule_once(self.do_start_connecting, .1)
else:
self.do_start_connecting()

def do_start_connecting(self, interval=None):
if _Debug:
print('DeviceDisconnectedScreen.do_start_connecting', self.counter)
self.counter += 1
web_sock_remote.start(
callbacks={
Expand Down

0 comments on commit 358abb5

Please sign in to comment.