I'm trying to add parameter into connection to signalr.
I'm using Builder to create my Client connection and start it:
var connection = new HubConnectionBuilder()
.WithUrl("http://10.0.2.162:5002/connection")
.WithConsoleLogger()
.WithMessagePackProtocol()
.WithTransport(TransportType.WebSockets)
.Build();
await connection.StartAsync();
I want to send a simple parameter in this connection: Something Like:
"Token": "123"
In my server side i think i can take this parameter from HttpContext:
public override Task OnConnectedAsync()
{
var httpContext = Context.Connection.GetHttpContext();
var token = httpContext.Request.Query["Token"];
return base.OnConnectedAsync();
}
Any idea of how to send this parameter? Thanks.