Unable to pass information from the client to the hub
See original GitHub issueContext.GetHttpContext() returns the HttpContext in SignalR mode, but returns null in AzureSignalR mode. Therefore I can’t read any QueryString or custom Http Header values in the OnConnectedAsync() method of the Hub. I’m using the following code to create the connection.
var connection = new HubConnectionBuilder().WithUrl("http://localhost:5000/message?t=TestValue",
options => options.Headers = new Dictionary<string, string>
{
{
"X-CustomHeader", "CustomValue"
}
})
.Build();
await connection.StartAsync();
Is there any way to pass information from the client to the hub using the AzureSignalR service?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:10 (7 by maintainers)
Top Results From Across the Web
angular - Failed to invoke signalR
Since your Hub method is called Send1 and your client calls Send , the method is not found. To fix the issue you...
Read more >ASP.NET Core SignalR connection troubleshooting
This error is usually caused by a client using only the WebSockets transport but the WebSocket protocol isn't enabled on the server. Response ......
Read more >Troubleshoot Common DMVPN Issues
This document describes the most common solutions to Dynamic Multipoint VPN (DMVPN) problems.
Read more >Signalr javascript client example. To avoid using sticky sess
NET SignalR hub from JavaScript client. For information about how to specify a different base URL, see ASP. NET SignalR application using the...
Read more >Developer Hub - Build Upload Failed - PROCESSING
I am trying to upload a new build of my game through the Meta Quest Developer Hub. I am uploading it to a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Do you have an estimation as to when this fix is going to be deployed? I’m trying to pass an auth0 token to the hub method. This is normally passed as a bearer token in authorization header. However as stated in this post, custom header is not possible because of limitations of JS websocket client which does not allow for it. So I wanted to pass my token as query parameter, but it never reaches my hub. Where should I read the query parameters anyway? From Context.Items? Because my Context does not contain Request property as in the example above, and I’ve installed the nuget package of SignalR just today.
Yes, the headers are not passed through from client to server. We will need some discussion to decide whether to support it. A work around is to create a separate hub method and call this method to send information once the client is connected.