Azure Functions bindings for SignalR Service. Project moved to https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/signalr/Microsoft.Azure.WebJobs.Extensions.SignalRService .
MIT License
97
stars
47
forks
source link
Multiple Hubs per Function with OnConnected Method #194
I have two class-based model hubs exposed by the same Function, however The OnConnected method name is problematic because a function cannot have duplicate names and I cannot use binding or I get the following error:
The 'OnConnected' function is in error: Microsoft.Azure.WebJobs.Host: Error indexing method 'OnConnected'. Microsoft.Azure.WebJobs.Extensions.SignalRService: SignalRTriggerAttribute must use parameterless constructor in class based model.
class FooHub : ServerlessHub
{
[FunctionName(nameof(NegotiateFoo))]
public Task<SignalRConnectionInfo> NegotiateFoo([HttpTrigger(AuthorizationLevel.Anonymous, "post")] HttpRequest httpRequest, ILogger logger)
{
...
}
[FunctionName(nameof(OnConnected))]
public async Task OnConnected([SignalRTrigger] InvocationContext invocationContext, ILogger logger)
{
...
}
}
class BarHub : ServerlessHub
{
[FunctionName(nameof(NegotiateBar))]
public Task<SignalRConnectionInfo> NegotiateBar([HttpTrigger(AuthorizationLevel.Anonymous, "post")] HttpRequest httpRequest, ILogger logger)
{
...
}
[FunctionName(nameof(OnConnected))]
public async Task OnConnected([SignalRTrigger] InvocationContext invocationContext, ILogger logger)
{
...
}
}
I have two class-based model hubs exposed by the same Function, however The
OnConnected
method name is problematic because a function cannot have duplicate names and I cannot use binding or I get the following error: