jamiewest / signalr_core

ASP.NET Core SignalR Dart Client
https://pub.dev/packages/signalr_core
MIT License
91 stars 58 forks source link

Connection closed without calling onClose callback #113

Open NikyAccet53 opened 2 weeks ago

NikyAccet53 commented 2 weeks ago

After leaving the app opened for a long time, the hub is not recieving incoming signal r messages. The connection status is still connected and no callback has been called (onclose, onreconnect, onreconnecting)

This is how I created the HubConnection:

final connection = HubConnectionBuilder()
        .withUrl(
            ServiceUtilities.ENDPOINT + URL,
            HttpConnectionOptions(
                logging: (level, message) => print(message),
                accessTokenFactory: () async =>
                    ServiceUtilities.UserLogged!.token))
        .withAutomaticReconnect()
        .build();

    connection.serverTimeoutInMilliseconds = 1000 * 60 * 60 * 24;
    connection.keepAliveIntervalInMilliseconds = 5 * 1000;

    await connection.start();

In debug console i found this:

HttpConnection.stopConnection(Exception: WebSocket closed with status code: 1006 ().) called while in state ConnectionState.connected. Connection disconnected with error 'Exception: WebSocket closed with status code: 1006 ().'. (WebSockets transport) socket closed. HttpConnection.stopConnection(Exception: WebSocket closed with status code: 1006 ().) called while in state ConnectionState.connected. Connection disconnected with error 'Exception: WebSocket closed with status code: 1006 ().'. (WebSockets transport) socket closed. HttpConnection.stopConnection(Exception: WebSocket closed with status code: 1006 ().) called while in state ConnectionState.connected. Connection disconnected with error 'Exception: WebSocket closed with status code: 1006 ().'. (WebSockets transport) socket closed. HttpConnection.stopConnection(Exception: WebSocket closed with status code: 1006 ().) called while in state ConnectionState.connected. Connection disconnected with error 'Exception: WebSocket closed with status code: 1006 ().'. RangeError: Maximum call stack size exceeded dart-sdk/lib/_internal/js_shared/lib/rti.dart 1365:34 _generalAsCheckImplementation dart-sdk/lib/async/future_impl.dart 421:5 get [_chainSource] dart-sdk/lib/async/future_impl.dart 462:26 [_addListener] 5467 dart-sdk/lib/async/future_impl.dart 464:17 [_addListener] dart-sdk/lib/async/future_impl.dart 372:5 catchError packages/signalr_core/src/http_connection.dart 291:7 [_stopConnection] packages/signalr_core/src/http_connection.dart 461:28 packages/signalr_core/src/transports/web_socket_transport.dart 132:11 [_close] packages/signalr_core/src/transports/web_socket_transport.dart 87:9 dart-sdk/lib/async/zone.dart 1582:9 runGuarded dart-sdk/lib/async/stream_impl.dart 418:7 sendDone dart-sdk/lib/async/stream_impl.dart 428:7 [_sendDone] dart-sdk/lib/async/stream_impl.dart 317:7 [_close] dart-sdk/lib/async/stream_controller.dart 792:5 [_sendDone] dart-sdk/lib/async/stream_controller.dart 818:7 [_sendDone] dart-sdk/lib/async/stream_controller.dart 647:7 [_closeUnchecked] dart-sdk/lib/async/stream_controller.dart 640:5 close packages/stream_channel/src/guarantee_channel.dart 55:13 dart-sdk/lib/async/zone.dart 1582:9 runGuarded dart-sdk/lib/async/stream_impl.dart 418:7 sendDone dart-sdk/lib/async/stream_impl.dart 428:7 [_sendDone] dart-sdk/lib/async/stream_impl.dart 317:7 [_close] dart-sdk/lib/async/stream_controller.dart 792:5 [_sendDone] dart-sdk/lib/async/stream_controller.dart 818:7 [_sendDone] dart-sdk/lib/async/stream_controller.dart 647:7 [_closeUnchecked] dart-sdk/lib/async/stream_controller.dart 640:5 close dart-sdk/lib/async/stream_controller.dart 884:29 close packages/stream_channel/src/guarantee_channel.dart 188:38 close packages/web_socket_channel/html.dart 128:25 dart-sdk/lib/async/zone.dart 1661:54 runUnary dart-sdk/lib/async/future_impl.dart 163:18 handleValue dart-sdk/lib/async/future_impl.dart 847:44 handleValueCallback dart-sdk/lib/async/future_impl.dart 876:13 _propagateToListeners dart-sdk/lib/async/future_impl.dart 643:7 [_complete] dart-sdk/lib/async/stream_pipe.dart 59:43 dart-sdk/lib/async/zone.dart 1655:54 run dart-sdk/lib/async/future_impl.dart 206:18 handleWhenComplete dart-sdk/lib/async/future_impl.dart 817:38 handleWhenCompleteCallback dart-sdk/lib/async/future_impl.dart 873:11 _propagateToListeners dart-sdk/lib/async/future_impl.dart 652:5 [_completeWithValue] dart-sdk/lib/async/future_impl.dart 722:7 callback dart-sdk/lib/async/schedule_microtask.dart 40:11 _microtaskLoop dart-sdk/lib/async/schedule_microtask.dart 49:5 _startMicrotaskLoop dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 181:7 RangeError: Maximum call stack size exceeded dart-sdk/lib/_internal/js_shared/lib/rti.dart 1365:34 _generalAsCheckImplementation dart-sdk/lib/async/future_impl.dart 421:5 get [_chainSource] dart-sdk/lib/async/future_impl.dart 462:26 [_addListener]