You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unhandled Exception: Exception: HttpConnection.stopConnection(Exception: WebSocket closed with status code: 1002 (null).) was called while the connection is still in the connecting state.
#111
Open
yunus00fkrt opened this issue
Feb 28, 2024
· 2 comments
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.19.0, on macOS 12.7 21G816 darwin-x64, locale tr-TR)
[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
✗ cmdline-tools component is missing
Run path/to/sdkmanager --install "cmdline-tools;latest"
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run flutter doctor --android-licenses to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[!] Xcode - develop for iOS and macOS (Xcode 14.2)
! CocoaPods 1.11.3 out of date (1.13.0 is recommended).
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To upgrade see https://guides.cocoapods.org/using/getting-started.html#updating-cocoapods for instructions.
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] VS Code (version 1.85.1)
[✓] Connected device (3 available)
[✓] Network resources
This is my signalr_core package version:
signalr_core: ^1.1.2
The text was updated successfully, but these errors were encountered:
Hi,
I want to open a SignalR connection, but sometimes it gives me this error and my connection doesn't open.
Error Message:
I/flutter ( 2560): tableStatusChanged signalr: (WebSockets transport) socket closed.
I/flutter ( 2560): tableStatusChanged signalr: HttpConnection.stopConnection(Exception: WebSocket closed with status code: 1002 (null).) called while in state ConnectionState.connecting.
I/flutter ( 2560): tableStatusChanged signalr: Call to HttpConnection.stopConnection(Exception: WebSocket closed with status code: 1002 (null).) was ignored because the connection is still in the connecting state.
E/flutter ( 2560): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Exception: HttpConnection.stopConnection(Exception: WebSocket closed with status code: 1002 (null).) was called while the connection is still in the connecting state.
E/flutter ( 2560): #0 HttpConnection._stopConnection (package:signalr_core/src/http_connection.dart:273:7)
E/flutter ( 2560): #1 HttpConnection._startTransport. (package:signalr_core/src/http_connection.dart:457:28)
E/flutter ( 2560): #2 WebSocketTransport._close (package:signalr_core/src/transports/web_socket_transport.dart:130:19)
E/flutter ( 2560): #3 WebSocketTransport.connect. (package:signalr_core/src/transports/web_socket_transport.dart:85:9)
E/flutter ( 2560): #4 _RootZone.runGuarded (dart:async/zone.dart:1582:10)
E/flutter ( 2560): #5 _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:392:13)
E/flutter ( 2560): #6 _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:402:7)
E/flutter ( 2560): #7 _BufferingStreamSubscription._close (dart:async/stream_impl.dart:291:7)
E/flutter ( 2560): #8 _ForwardingStream._handleDone (dart:async/stream_pipe.dart:99:10)
E/flutter ( 2560): #9 _ForwardingStreamSubscription._handleDone (dart:async/stream_pipe.dart:161:13)
E/flutter ( 2560): #10 _RootZone.runGuarded (dart:async/zone.dart:1582:10)
E/flutter ( 2560): #11 _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:392:13)
E/flutter ( 2560): #12 _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:402:7)
E/flutter ( 2560): #13 _BufferingStreamSubscription._close (dart:async/stream_impl.dart:291:7)
E/flutter ( 2560): #14 _SyncStreamControllerDispatch._sendDone (dart:async/stream_controller.dart:792:19)
E/flutter ( 2560): #15 _StreamController._closeUnchecked (dart:async/stream_controller.dart:647:7)
E/flutter ( 2560): #16 _StreamController.close (dart:async/stream_controller.dart:640:5)
E/flutter ( 2560): #17 new _WebSocketImpl._fromSocket. (dart:_http/websocket_impl.dart:1156:19)
E/flutter ( 2560): #18 _RootZone.runBinaryGuarded (dart:async/zone.dart:1606:10)
E/flutter ( 2560): #19 _BufferingStreamSubscription._sendError.sendError (dart:async/stream_impl.dart:358:15)
E/flutter ( 2560): #20 _BufferingStreamSubscription._sendError (dart:async/stream_impl.dart:373:9)
E/flutter ( 2560): #21 _BufferingStreamSubscription._addError (dart:async/stream_impl.dart:280:7)
E/flutter ( 2560): #22 _SinkTransformerStreamSubscription._addError (dart:async/stream_transformers.dart:75:11)
E/flutter ( 2560): #23 _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:113:7)
E/flutter ( 2560): #24 _HttpDetachedStreamSubscription._maybeScheduleData. (dart:_http/http_parser.dart:173:20)
E/flutter ( 2560): #25 _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
E/flutter ( 2560): #26 _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
E/flutter ( 2560):
I/flutter ( 2560): tableStatusChanged signalr: The HttpConnection connected successfully.
I/flutter ( 2560): tableStatusChanged signalr: Sending handshake request.
I/flutter ( 2560): tableStatusChanged signalr: Hub handshake failed with error 'Null check operator used on a null value' during start(). Stopping HubConnection.
I/flutter ( 2560): tableStatusChanged signalr: HubConnection failed to start successfully because of error '{type '_TypeError' is not a subtype of type 'Exception' in type cast.toString()}'.
E/flutter ( 2560): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: type '_TypeError' is not a subtype of type 'Exception' in type cast
E/flutter ( 2560): #0 HubConnection._startInternal (package:signalr_core/src/hub_connection.dart:221:44)
E/flutter ( 2560):
E/flutter ( 2560): #1 HubConnection._startWithStateTransitions (package:signalr_core/src/hub_connection.dart:154:7)
E/flutter ( 2560):
E/flutter ( 2560): #2 SalePageController.openTablesStatusConnection (package:giby_pos/modules/sale/controllers/sale_page_controller.dart:112:5)
E/flutter ( 2560):
E/flutter ( 2560): #3 MainPageMixin.initState. (package:giby_pos/modules/main/mixins/main_page_mixin.dart:32:9)
E/flutter ( 2560):
E/flutter ( 2560):
It seems to be giving the error specifically on this line:
await connection.start();
This is my open connection method:
Future openTablesStatusConnection() async {
connection = HubConnectionBuilder()
.withUrl(
"${appBaseUrl}/addition?access_token=$token",
HttpConnectionOptions(
logging: (level, message) =>
debugPrint("tableStatusChanged signalr: $message")))
.withAutomaticReconnect()
.build();
await connection.start();
connection.on('TableStatusChanged', (arguments) async {
// do something
});
}
This is my flutter doctor output:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.19.0, on macOS 12.7 21G816 darwin-x64, locale tr-TR)
[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
✗ cmdline-tools component is missing
Run
path/to/sdkmanager --install "cmdline-tools;latest"
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run
flutter doctor --android-licenses
to accept the SDK licenses.See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[!] Xcode - develop for iOS and macOS (Xcode 14.2)
! CocoaPods 1.11.3 out of date (1.13.0 is recommended).
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To upgrade see https://guides.cocoapods.org/using/getting-started.html#updating-cocoapods for instructions.
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] VS Code (version 1.85.1)
[✓] Connected device (3 available)
[✓] Network resources
This is my signalr_core package version:
signalr_core: ^1.1.2
The text was updated successfully, but these errors were encountered: