Your approach to sending messages using SignalR in an isolated worker process seems correct. You’re using the ServiceBusTrigger
to trigger the function when a message arrives in the Service Bus queue, which is a common pattern for asynchronous messaging.
The SignalROutput
attribute is used to send messages to a SignalR hub. The HubName
and ConnectionStringSetting
parameters seem to be correctly configured, assuming that “SignalRHub” is the name of your SignalR hub and “AzureSignalRConnectionString” is the name of the app setting that contains your Azure SignalR Service connection string.
The IAsyncCollector<SignalRMessageAction>
parameter, signalRMessages
, is used to send multiple output items (in this case, SignalR messages) from your function. This is suitable for an isolated worker process. The IAsyncCollector
interface provides an AddAsync
method that you can call to add items to the output collection. These items are sent when your function completes.
However, please ensure that the UserId
is correctly encoded and the pushNotificationMessage.Message
and pushNotificationMessage.ResponseEndpoint
are correctly populated.
Things to explore:
- logging to trace the issue
- retry if functions logs an exception
- dead-letter queues
- try testing different message sizes
- test when SignalR is offline