Azure SignalR Integration IAsyncCollector equivalent?
See original GitHub issueWe use the SignalR integration with Azure Functions using the IAsyncCollector output binding
[FunctionName("SendMessage")]
public static Task SendMessage(
[HttpTrigger(AuthorizationLevel.Anonymous, "post")]object message,
[SignalR(HubName = "chat")]IAsyncCollector<SignalRMessage> signalRMessages)
{
return signalRMessages.AddAsync(
new SignalRMessage
{
// the message will only be sent to these user IDs
UserId = "userId1",
Target = "newMessage",
Arguments = new [] { message }
});
}
In attempting to migrate over I tried changing the AsyncCollector over to OutputBinding<SignalRMessage>, but using this only the last message added is actually sent. Is there a way to send multiple messages as the process is running?
[FunctionName("SendMessage")]
public static Task SendMessage(
[HttpTrigger(AuthorizationLevel.Anonymous, "post")]object message,
[SignalR(HubName = "chat")]OutputBinding<SignalRMessage> signalRMessages)
{
return signalRMessages.AddAsync(
new SignalRMessage
{
// the message will only be sent to these user IDs
UserId = "userId1",
Target = "newMessage",
Arguments = new [] { message }
});
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Azure WebJobs SignalR Service client library for .NET
Azure SignalR resource: To use SignalR Service client library ... the SignalR attribute to the IAsyncCollector<SignalRMessage> parameter.
Read more >Azure Function SignalR Output Binding - How to receive ...
My environment: 1 - Azure Function which does some work and then sends a message to the SignalR service. 2 - A NET...
Read more >Replace Signal R with Azure Signal R #9976
I am using "@microsoft/signalr": "^5.0.1",. Everything just works for me. Also @ismcagdas is talking about the config files in the angular ...
Read more >Serverless real-time messaging with Azure Functions and ...
This function will be called to broadcast a message to all connected clients through our SignalR Service. Therefore we will create a new ......
Read more >Using the Azure SignalR Service Bindings in ...
The Azure SignalR Service is a serverless offering from Microsoft to facilitate real-time communications without having to manage the ...
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 Free
Top 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
@anthonychu I think this is actually about two different things (@sccrgoalie1 , please correct me if I’m wrong), both about the cardinality (sending multiple messages) and the real time behavior of the async collector provided by the SignalR extension. The latter will not be addressed by GA (messages will only be sent when the function returns)
You should be able to use
OutputBinding<IEnumerable< SignalRMessage >>
but this is not working in preview3. Tracking this here: https://github.com/Azure/azure-functions-dotnet-worker/issues/124