Search code examples
signalrserverlessasp.net-core-signalrsignalr-client

How to send message from the js library to a group in Azure SignalR Serverless


Hi I'm trying to send a message to a group using the Azure Signal R Serverless JS Client Js Library.

I can do this from the Azure Serverless Function as simply as:

await signalRMessages.AddAsync(
                new SignalRMessage
                {
                    GroupName = m.GroupName,
                    Target = m.Target,
                    Arguments = new[] { m.Message }
                });

*where signalRMessages = IAsyncCollector signalRMessages

How can I send this same message from the js library?


Solution

  • It's seems like this is now possible ...

    https://learn.microsoft.com/en-us/azure/azure-signalr/signalr-concept-serverless-development-config#sending-messages-from-a-client-to-the-service

    Sending messages from a client to the service If you have upstream configured for your SignalR resource, you can send messages from client to your Azure Functions using any SignalR client. Here is an example in JavaScript:

    JavaScript

    connection.send('method1', 'arg1', 'arg2');