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

Connection to {MY_SOCKET_URL} was not upgraded to websocket #164

Closed
lionuncle opened this issue Apr 9, 2021 · 7 comments
Closed

Connection to {MY_SOCKET_URL} was not upgraded to websocket #164

lionuncle opened this issue Apr 9, 2021 · 7 comments
Labels
type-question A question about expected behavior or functionality

Comments

@lionuncle
Copy link

channel = IOWebSocketChannel.connect(Uri.encode(MY_SOCKET_URL));
I'm listening to this channel and the snapshot returns

WebSocketChannelException: WebSocketException: Connection to 'http://dev-system.worksamurai.com.au:0/api/websocket/messages/support?accessToken=oi+wBZblSq=&id=48#' was not upgraded to websocket

@vishalsgithub
Copy link

Same Issue

@sopherwang
Copy link

I'm having the same iseue as well. Did you find out the root of cause? Thanks

@birimkulov951
Copy link

any solutions?

@dazza5000
Copy link

This started popping up for me

@natebosch
Copy link
Member

This looks like the server side is not upgrading the connection to a websocket. Stack Overflow is likely a better resource for specific implementation issues. You may need to post the specific request and response data to see what is going wrong.

@natebosch natebosch added the type-question A question about expected behavior or functionality label Aug 17, 2021
@BhavyaRattan
Copy link

@natebosch I am facing the same issue as well, it works perfectly on postman so I doubt if it's from server-side, looks like a flutter specific issue as reported by many other devs: flutter/flutter#11444

@natebosch
Copy link
Member

From flutter/flutter#11444 (comment) and dart-lang/sdk#25120 it looks like it's most likely caused by a server that does not comply with the HTTP spec and the Dart SDK's behavior around lowercasing header names.

I'm not sure if we have a workaround for this - @brianquinlan do you know of any way to force certain header casing with the dart:io HTTP client and websocket implementation?

It may be feasible to implement the socket upgrade code yourself, with whatever quirks of header casing necessary to appease the buggy server, and then use WebSocket.fromUpgradedSocket. https://api.dart.dev/stable/2.16.0/dart-io/WebSocket/WebSocket.fromUpgradedSocket.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-question A question about expected behavior or functionality
Projects
None yet
Development

No branches or pull requests

7 participants