azure-signalr
azure-signalr copied to clipboard
Get connected users list in Azure SignalR serverless mode
Hi,
how can be get he list of connected users on Azure SignalR serverless mode : currently we handle a list in a DB based on OnConnect/OnDisconnect events, but is it enought ? Could we directly call Azure SignalR via API and get the information ?
We plan to use this mode in production with more than 4k sockets permanently.
I use this sample implementation (with EventGrid/Azure functions) : https://github.com/aspnet/AzureSignalR-samples/tree/master/samples/EventGridIntegration#sample-azure-signalr-service-integration-with-event-grid-and-azure-function
Thank you for your help
Hi,
Your solution works for most cases.
But you should realize: OnDisconnect
event is not reliable in some rare cases, for example, if one of VM for the service instance lost the network or crashed, then we cannot send disconnected events.
Currently, we are working on forwarding serverless client messages to Azure function, it will be available in next quarter, that means your clients can send some messages to Azure function. At that time, the best solution should be:
Keep alive:
Client -------------> Azure SignalR Service -------> Azure Function ------> Database
alive message forward update
Query user/connection:
select * from Database where updatetime>now()-1min
@NicolasReyDotNet Sorry cannot find your contact so ping you here. I'm the Product Manager of Azure SignalR Service, and we have a new internal preview for supporting raw WebSocket in serverless scenarios, thinking you might be interested to try it out and offer us some feedback. If you are interested please ping me at zhshang at microsoft.com.
@sffamily So it's been a few months and it was in internal preview. Is there something released in the meantime? Something to get the active connections/users to a hub or method?
Hi @sffamily. Are there any news regarding this upcoming feature?