Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebSocketException: Connection to '<url>' was not upgraded to websocket, HTTP status code: 403 #105

Open
pgulegin opened this issue Jan 21, 2025 · 0 comments

Comments

@pgulegin
Copy link

Using version 1.3.9, everything was working as expected.
1.4.0 appears to have this breaking change.

In the code/exception below, 'url' denotes the original url I used.
However, 'url_modified' is my original url, but it has been modified to include a port number and a hashtag.

So, if my original url was something like... https://www.google.com/Channels/Support
Then, the new url is... https://www.google.com:0/Channels/Support#

Code

    connection = HubConnectionBuilder()
        .withUrl('<url>',
            options: HttpConnectionOptions(
              accessTokenFactory: () async {
                return fetchAccessToken();
              },
              skipNegotiation: true,
              transport: HttpTransportType.WebSockets,
              logger: _logger,
              logMessageContent: true,
            ))
        .withAutomaticReconnect(retryDelays: [1, 3000, 10000, 30000]).build();

Exception

[ChatPageViewModel] WebSocket try connecting to 'wss://<url>'.
flutter: WebSocket try connecting to 'wss://<url>'.
flutter: 2025-01-20 17:24:23.514104 ══╡ EXCEPTION CAUGHT BY CHATPAGEVIEWMODEL ╞═════════════════════════════════════════════════════════
The following _Exception was thrown WebSocket connection to 'wss://<url>'
failed: WebSocketException: Connection to '<url_modified>' was not
upgraded to websocket, HTTP status code: 403:
Exception
════════════════════════════════════════════════════════════════════════════════════════════════════
flutter: WebSocket connection to 'wss://<url>' failed: WebSocketException: Connection to '<url_modified>' was not upgraded to websocket, HTTP status code: 403
flutter: 2025-01-20 17:24:23.514711 Another exception was thrown: Exception
flutter: Failed to start the connection: WebSocketException: Connection to '<url_modified>' was not upgraded to websocket, HTTP status code: 403
flutter: 2025-01-20 17:24:23.515032 _ChatStore() startConnection() WebSocketException: Connection to '<url_modified>' was not upgraded to websocket, HTTP status code: 403

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant