Closed kzryzstof closed 1 year ago
You should use binding expression {headers.userSid}
to set the user ID.
[Function("negotiate")]
public Task<SignalRConnectionInfo> OnNegotiateAsync
(
[HttpTrigger(AuthorizationLevel.Anonymous, "POST")]
HttpRequestData httpRequestData,
[SignalRConnectionInfoInput(HubName = Constants.HubName, ConnectionStringSetting = "AzureSignalRConnectionString", UserId = "{headers.userSid}")])]
SignalRConnectionInfo signalRConnectionInfo
)
{
...
return signalRConnectionInfo;
}
See https://github.com/aspnet/AzureSignalR-samples/tree/main/samples/DotnetIsolated-BidirectionChat for a complete sample
Exactly what I was missing! Thanks!! :)
I have an
EventGrid
TriggerAzure Function
(using the isolated worker on.net7
) that is called each time a client connects a SignalR hub. It is setup like this:On the client side, the application connects the SignalR via the Negotiate API like this:
Here is what the
Negotiate
function is doing which returns the URL along with an additional :The
OnConnectivityEventsChangedAsync
Function is properly called when the client gets connected. However, it does not provide all the information that I need: theUser ID
is missing.Question
In the SignalR documentation, it is stated that the connected event should provide the
user ID
along with theconnection ID
. Here is what I get:What should I do to get the
User ID
along with theConnection ID
?