I am using the Azure SignalR Service in combination with Azure Functions and I have the following code:
public class SignalRHubFunction
{
[FunctionName("SignalRConnected")]
public async Task Run([SignalRTrigger("myhubname", "connections", "connected", ConnectionStringSetting = "AzureSignalRConnectionString")] InvocationContext invocationContext, ILogger logger)
{
logger.LogInformation($"{invocationContext.ConnectionId} connected");
}
}
I have a hard time getting a trigger on the 'OnConnected' event. Samples are only given with Class based model. And the docs aren't really helpful for me.
Docs are telling me the category parameter of the SignalRTrigger
constructor should be: connections or messages.
So I use connections.
This value must be set as the category of messages for the function to be triggered. The category can be one of the following values: connections: Including connected and disconnected events messages: Including all other events except those in connections category
I don't really understand what the docs mean with the event parameter
This value must be set as the event of messages for the function to be triggered. For messages category, event is the target in invocation message that clients send. For connections category, only connected and disconnected is used.
I guess they are saying you can choose between connected and disconnected.
However with the code from above the trigger is never hit. Any thoughts?