I am trying to implement the Azure SignalR service in the Azure function with an Isolated process. So far it's working Ok for me. I read the Microsoft docs, there it mentioned that for registering any output binding, I need to create the azure function for it. Below is my code:
[Function("BroadcastToAll")]
[SignalROutput(HubName = "demohub", ConnectionStringSetting = "AzureSignalRConnectionString")]
public SignalRMessageAction BroadcastToAll([HttpTrigger(AuthorizationLevel.Anonymous, "post")] HttpRequestData req)
{
try
{
using var bodyReader = new StreamReader(req.Body);
var d = bodyReader.ReadToEnd();
return new SignalRMessageAction("newMessage")
{
// broadcast to all the connected clients without specifying any connection, user or group.
Arguments = new[] { d },
};
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
My question is it mandatory to have the return type as SignalRMessageAction
. How can I let its return type like HttpResponseData
.