1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-26 14:59:22 +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 // Clear Futures queue
_requests.clear(); _requests.clear();
_ws = null;
EventsHelper.emit(WSClosedEvent()); EventsHelper.emit(WSClosedEvent());
}, },
); );

View File

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