Azure / azure-signalr

Azure SignalR Service SDK for .NET
https://aka.ms/signalr-service
MIT License
427 stars 101 forks source link

How to add a strongly typed SignalR Hub when using Mangament #1775

Open ZisisTsatsas opened 1 year ago

ZisisTsatsas commented 1 year ago

Can I add a strongly typed SignalR Hub when using Management on a serverless configuration?

I want to add a strongly typed hub in my signalr service to be used by the client, is this possible when using Management and ServiceHubContext?

If not how can invoke methods from clients? Send messages between clients or have clients add themselves to groups for example.

Y-Sindo commented 1 year ago

Although strongly typed hub is supported, client invocation is not supported yet. Duplicated: #1756

ZisisTsatsas commented 1 year ago

is there plans for it to be supported?

Y-Sindo commented 1 year ago

is there plans for it to be supported?

Yes

Y-Sindo commented 1 year ago

@ZisisTsatsas Sorry that I have found that I may misunderstand your problem. What you want to do in Call hub methods from clients, right? It's not convenient to achieve it only with Management SDK. We recommend you use Azure Functions with SignalR trigger.

Please note that Strongly typed hubs in SignalR is more of the data flow from server to client.

Feel free to ask more questions.

ZisisTsatsas commented 1 year ago

@Y-Sindo Is there a way to do this without Azure Functions? Currently, I am hosting SignalR alongside my API in an Azure WebApp and I am using Redis Stack to have consistency over different regions, but it has some issues so I want to switch to the Azure SignalR service

Y-Sindo commented 1 year ago

Yes, you can do this without Azure Functions. SignalR trigger is nothing more than a REST API server that handles client events. Therefore, you can also implement a REST API server to do this: