-
Notifications
You must be signed in to change notification settings - Fork 58
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
Exception: The underlying connection was closed before the hub handshake could complete. #5
Comments
Thank you for your issue, would it be possible for you to share the logs when you connect? I did some basic testing with Azure and will probably need to focus some attention here. Thanks! |
Hi there is my logs: I/flutter (17280): Starting HubConnection. You can try with this url: |
Just a quick update, I haven't had a chance to start coding a fix yet. The underlying socket is not getting upgraded when connecting. I will need to modify the underlying web_socket_channel library to accept an upgraded socket when not running on the web. I tried testing the web version with your site but failed due to the cors policy. Long polling and server sent events seem to work okay. |
Hi @jamiewest tnx for info. I have tried with long polling and it's working for me also (didn't know about this). If you need my azure signalr site to test from web i can try to configure CORS for you if you need, just ping me here and i will look when i have time. |
I made some progress but I am not receiving at 503 (service unavailable) error from your backend. Any ideas? |
@jamiewest 503 error is probably because of site is running in free plan only 60 min execution per day. I have upgraded the service plan and it should be online for all day.
|
I am waiting to see if a pull request is accepted regarding #387 in I did end up pushing my own SignalR app in an Azure App Service plan, the free one, to see if I could recreate the problems you are having. During the process it asked specifically if I wanted to enable websockets, which I did. I think yours might me missing this piece, you can check this by going into the app service/configuration/general settings area and make sure the radio button is enabled for web sockets. |
@jamiewest websockets are enabled. I just made another test. I have two apps on azure one is based on windows and other on linux service plan. And yes it is working with windows but not the linux one. So i don't know if this is a bug with library or azure it self. Maybe you can try with linux service plan (it is much cheaper then windows based). |
@jamiewest somehow i cannot reproduce this anymore on linux instance of azure it is even started to work with " transport: HttpTransportType.webSockets". I have also tested with flutter web and it is also working with one thing that i need to disable skipNegotiation. So you can close this one! |
Okay, thanks. Once the http package is published with my changes I will publish this library with a handful of bug fixes. Hopefully soon... |
have you solved this I'm getting this error after 2 years of yours |
I am getting this error as well.. |
I am getting this error as well. |
I was facing the same issue and stopping hubConnection before super.dispose solved my issue.
|
Were you able to solve the problem? |
eso en que archivo lo agregaste? |
This issue usually occurs on Linux servers, in my experience, it's not related to the package itself, but rather to the server configurations. |
I still have the same issue. I use IdentityServer 4, and the following setup is recommended for signal authentication using the access token(according to https://learn.microsoft.com/en-us/aspnet/core/signalr/authn-and-authz?view=aspnetcore-7.0#identity-server-jwt-authentication). It's not related to the OS, and I am suspicious it's related to the library that cannot update the connection.
When I start a socket connection request, everything seems fine, and the " context.Token" will be set according to the token. Still, suddenly, I received the error "The underlying connection was closed before the hub handshake could complete." from Flutter and my connection will be closed |
I think the issue is on the server, try changing the connection protocol to long pooling |
@madagaskarr |
@jamiewest |
I fixed this on the nginx server by adding support to upgrade the connection. The library work as expected! |
@madagaskarr iam using IIS any suggestions ? |
In my case the problem happened only when I was using [Authrize] attribute in hub.
|
Hi, tnx for package!
I'm getting this error while trying to connect to hub that's deployed to azure running emulator.
`final connection = HubConnectionBuilder()
.withUrl(
'https://fortestpurpose.azurewebsites.net/hub',
HttpConnectionOptions(
transport: HttpTransportType.webSockets,
logging: (level, message) => print(message),
))
.withAutomaticReconnect()
.build();
await connection.start();`
Using localhost service there is no such error for example with url:
http://10.0.2.2:5000/hub
Any clues why this can happen?
The text was updated successfully, but these errors were encountered: