signalr_client
signalr_client copied to clipboard
WebSocketException: Connection to #server failed because the connection was not upgraded to websocket
Hi,
Since the transition from 1.3.9 to 1.4.0 I can no longer establish a connection with the SignalR server, the error states:
WebSocket connection to #server failed: WebSocketException: Connection to #server was not upgraded to websocket
No settings have been changed, and when I go back to 1.3.9, no more problems.
About settings :
final httpConnectionOptions = HttpConnectionOptions(
logger: logger,
logMessageContent: true,
requestTimeout: _requestTimeOut,
accessTokenFactory: () => Future.value(
'Bearer ${Config.serverAuth}|UserAuthorization $userToken'),
transport: HttpTransportType.WebSockets,
skipNegotiation: true,
);
_hubConnection = HubConnectionBuilder()
.withUrl(Config.signalRHubUrl, options: httpConnectionOptions)
.withAutomaticReconnect()
.configureLogging(logger)
.build();
I noticed since 1.4.0 there is a "0" port, which for me is not normal, namely that I don't specify the connection port in my configuration because it's the default SSL port: 443
But even specifying port 443, I have the same error :
But it is no longer specified "0" before the hashtag :
I think my problem comes from the modification of how the "access_token" went in 1.4.0 :
Indeed, in my project I have a double authentication, via an application token (valid for 1 year), and via the user's token (short duration).