mirror of
				https://gitlab.com/comunic/comunicmobile
				synced 2025-11-04 04:04:18 +00:00 
			
		
		
		
	Fix issues with WebSocket
This commit is contained in:
		@@ -67,6 +67,7 @@ class WebSocketHelper {
 | 
				
			|||||||
        // Clear Futures queue
 | 
					        // Clear Futures queue
 | 
				
			||||||
        _requests.clear();
 | 
					        _requests.clear();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        _ws = null;
 | 
				
			||||||
        EventsHelper.emit(WSClosedEvent());
 | 
					        EventsHelper.emit(WSClosedEvent());
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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))
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user