jamiewest / signalr_core

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

Firebase Hosting Connection failed (Exception: The underlying connection was closed before the hub handshake could complete..toString()) #83

Closed Invectys closed 2 years ago

Invectys commented 2 years ago

Hi, I have signalr deployed hub with authority signed certificate and cors setuped

When i try to connect from localhost it works well. When i try to connect from firebase hosting it throws exception and close connection.

LogLevel.debug Starting HubConnection.
main.dart.js:11097 LogLevel.debug Starting connection with transfer format 'TransferFormat.text'.
main.dart.js:11097 LogLevel.trace (WebSockets transport) Connecting.
main.dart.js:11097 LogLevel.debug The HttpConnection connected successfully.
main.dart.js:11097 LogLevel.debug Sending handshake request.
main.dart.js:11097 LogLevel.trace (WebSockets transport) sending data. String data of length '32'.
main.dart.js:11097 LogLevel.information Using HubProtocol 'json'.
main.dart.js:22129 WebSocket connection to 'wss://chat.tusa.pw/hubs/chat?access_token=access_token' failed: 
aSM @ main.dart.js:22129
main.dart.js:37292 Uncaught 
main.dart.js:11097 LogLevel.error (WebSockets transport) socket error: WebSocketChannelException: WebSocket connection failed.}
main.dart.js:11097 LogLevel.trace (WebSockets transport) socket closed.
main.dart.js:11097 LogLevel.debug HttpConnection.stopConnection(null) called while in state ConnectionState.connected.
main.dart.js:11097 LogLevel.information Connection disconnected.
main.dart.js:11097 LogLevel.debug HubConnection.connectionClosed(null) called while in state HubConnectionState.connecting.
main.dart.js:11097 LogLevel.debug Hub handshake failed with error 'Exception: The underlying connection was closed before the hub handshake could complete.' during start(). Stopping HubConnection.
main.dart.js:11097 LogLevel.debug Call to HttpConnection.stop(Exception: The underlying connection was closed before the hub handshake could complete.) ignored because the connection is already in the disconnected state.
main.dart.js:11097 LogLevel.debug HubConnection failed to start successfully because of error '{Exception: The underlying connection was closed before the hub handshake could complete..toString()}'.
main.dart.js:37292 Uncaught 
Invectys commented 2 years ago

I solved the problem by changing hosting. I am not sure what was the problem.

jamiewest commented 2 years ago

I am going to close, open another issue if it happens again.

Invectys commented 2 years ago

This error also occurs when the url(address) to the signalr hub is incorrect.