Note: this is not a duplicate question despite some similarities.
Microsoft recently started supporting messagePack
protocol when the transport type's mode is Persistent
per this article.
The challenge is that the Azure Function App supporting the backend uses the following pattern to send out a message to a group of users or a user:
[Function("sendMessage")]
[SignalROutput(HubName = "myhub")]
public static async Task<SignalRMessageAction> SendMsgAsync(
[HttpTrigger(AuthorizationLevel.Function, "post", Route = $"v1/{groupId}")]
HttpRequestData req,
string groupId,
FunctionContext context)
{
var message = await new StreamReader(req.Body).ReadToEndAsync();
return new("message")
{
GroupName = groupId,
Arguments = new[] { message }
};
}
There is no place in our function app host builder or configuration to make it leverage messagePack protocol. I can understand that [the mentioned article]((https://github.com/Azure/azure-signalr/blob/dev/docs/management-sdk-guide.md#transport-type) applies to ASP.NET core configuration but our function app's architecture is solely designed for a serverless environment.
I'm not sure if instantiating ServiceManagerBuilder
and passing its instance around through dependency injection is a great idea for our case. If that's the only option, it will introduce a lot of code changes and architecture changes in our code which is not desired and ideal.