1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 12:59:21 +00:00

Fix issues with WebSocket

This commit is contained in:
Pierre HUBERT 2021-02-18 19:36:51 +01:00
parent e399f71a78
commit 459757b292
2 changed files with 4 additions and 1 deletions

View File

@ -67,6 +67,7 @@ class WebSocketHelper {
// Clear Futures queue
_requests.clear();
_ws = null;
EventsHelper.emit(WSClosedEvent());
},
);

View File

@ -57,6 +57,8 @@ class _InitializeWidgetState extends SafeState<InitializeWidget> {
/// Try to connect to server
void _tryConnect() async {
try {
print("Attempting WebSocket connection...");
setState(() {
_error = false;
});
@ -78,7 +80,7 @@ class _InitializeWidgetState extends SafeState<InitializeWidget> {
@override
Widget build(BuildContext context) {
return !_error && WebSocketHelper.isConnected()
return (!_error && WebSocketHelper.isConnected())
? (isTablet(context)
? TabletRoute(key: mainControllerKey)
: SmartphoneMainRoute(key: mainControllerKey))