Add troubleshooting page for SignalR#20125
Conversation
|
|
||
| ## Troubleshoot WebSocket handshake errors | ||
|
|
||
| This section provides help on the *"Error during WebSocket handshake"* exception that occurs when trying to establish connection to ASP.NET Core SignalR hub. |
There was a problem hiding this comment.
Do we need quotes AND stars? One or the other seems like enough.
| WebSocket connection to 'wss://xxx/HubName' failed: Error during WebSocket handshake: Unexpected response code: 404 | ||
| ``` | ||
|
|
||
| * If the connection takes too long to send a request to the server after the negotiate the server will delete the ID and return a 404 if the connection uses that ID |
Rick-Anderson
left a comment
There was a problem hiding this comment.
@FredHan001 FYI, this should hlep.
|
@FredHan001 FYI |
Co-authored-by: Rick Anderson <3605364+Rick-Anderson@users.noreply.github.com>
|
@BrennanConroy let me know what's need to get this merged. Great info, thanks. |
|
I guess it needs author to be filled in to get rid of the warnings |
| * If the connection uses the ID and takes too long to send a request to the server after the negotiate, the server: | ||
|
|
||
| * Deletes the ID. | ||
| * Returns a 404. |
There was a problem hiding this comment.
This is probably the least common cause of a 404, don't you think? I would probably order the bullet points with bad path first, no sticky session second and this last.
| WebSocket connection to 'ws://xxx/HubName' failed: Error during WebSocket handshake: Unexpected response code: 307 | ||
| ``` | ||
|
|
||
| This error can also happen during the negotiate request. |
There was a problem hiding this comment.
Do any of the HTTP clients and/or WebSocket clients SignalR uses not follow 307 redirects? I just searched the aspnetcore repo for "SignalR 307" (without quotes) and came up with no reports of an issue like that.
There was a problem hiding this comment.
Found it: https://stackoverflow.com/questions/63437471/websocket-connection-to-ws-localhost5000-notificationhub-failed-error-duri. I'm still not sure that this could "happen during the negotiate request." Do you have evidence of that?
There was a problem hiding this comment.
Yes, I point out one possible cause below
There was a problem hiding this comment.
I don't see it. Why would a 307 break the negotiate request itself?
There was a problem hiding this comment.
Because we don't follow redirects
There was a problem hiding this comment.
Oh. Why? Because we assume it will break WebSockets?
There was a problem hiding this comment.
Hmm, I'm not sure. I thought it was because auth handlers often redirect instead of returning 401, but we set a header to try and avoid that...
There was a problem hiding this comment.
No, I made a bunch of suggestions, most were accepted. We can't merge this without the author meta-data. These are my suggestions, if you agree, I'll add them. |
|
The following needs to be added: Q: Customer would like to know on the server the reason of the disconnection. However the exception parameter of the A: I suspect you're right that there was some sort of network issue. If the connection closes between SignalR messages, the server may interpret that as an unexceptional client disconnect. I filed dotnet/aspnetcore#26701 to track the issue of not passing an Exception to Hub.OnDisconnectedAsync in this case. |
Co-authored-by: Rick Anderson <3605364+Rick-Anderson@users.noreply.github.com>
I don't know what kind of wording we want in the doc for something like this. |
|
Whilst not very friendly, I think the statement
Sums it up concisely. That said, i'd love some wordsmithery by @Rick-Anderson |
That's clear to me. |
Sure it's clear, but it doesn't mean anything. If we rephrase it a little it's equivalent to: "If the client closes the connection, it could be a graceful or ungraceful disconnect." |
|
@BrennanConroy I see your point. How about: Transient network failures may close the connection between SignalR messages. The server may interpret the closed connection as an unexceptional client disconnect. For more information, see this GitHub issue. |
|
@BrennanConroy added What I have is pretty incomplete, but the issue fleshes it out and we might get feedback on the issue. |
|
@BrennanConroy let me know when I can merge this. |
|
Lets wait till middle of the day tomorrow to give folks some time to take a look |
|
LGTM |
|
Ok, think it's good to go |

#20063
Needs some cleanup.
This is definitely missing some common scenarios. Don't need to get them all in this first pass.
@Rick-Anderson edit
Internal review URL