-
Notifications
You must be signed in to change notification settings - Fork 41
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
Handshake failing when connecting to .NET signalr server #142
Comments
can you share the server code? I guess there might be some confusion between ConnectionToken and ConnectionId, as https://github.com/dotnet/aspnetcore/blob/main/src/SignalR/docs/specs/TransportProtocols.md does not state where the id query parameter comes from. |
I believe I know what's causing the problem. The server uses loadbalancer and the client needs to set a "sticky" cookie in order for the loadbalancer to pass the handshake request to an expected backend server. Currently as far as I've been testing the handshake is done to a different backend server than the initial request that generated the So what I need to do is pass that |
It won't work with Line 76 in c9b8729
opts.HTTPHeader as Cookie headers before dialing here Line 122 in c9b8729
like for _, cookie := range resp.Cookies() {
opts.HTTPHeader.Add("Cookie", cookie.String())
}
ws, _, err := websocket.Dial(ctx, wsURL.String(), opts) can you please try this, and if it works, submit a PR? |
Appreciate your insight. Of course, I'll open a PR when I get it working. |
It is possible for another reason to cause this issue. When a server is stuck with a ConnectionToken while we use negotiateVersion=1 in the negotiation response, this can happen. If we negotiate without a version (as in lib), the negotiate version would be 0, and the post response for negotiation will not contain ConnectionToken. However, if we use version 1, we should use ConnectionToken in the next HTTP GET request after the negotiation. |
I'm trying to connect to a .NET server running signalr, but for some reason handshake is failing due to
No Connection with that ID
error.I can successfully connect to that particular signalr server using signalr typescript client.
I've put some
Println
's in the code in order to see if connection id really isn't being passed along but from what I'm able to see it is.Here are the Print outputs that I've added to
httpconnection.go
(signalr lib) anddial.go
(websocket lib):And this is how I instantiated the client:
I didn't notice anything out of the ordinary with the constructed requests (investigated headers as well) hence I'm in the dark if I'm perhaps using the client in a wrong way?
The text was updated successfully, but these errors were encountered: