azure-signalr icon indicating copy to clipboard operation
azure-signalr copied to clipboard

Get connected users list in Azure SignalR serverless mode

Open NicolasReyDotNet opened this issue 5 years ago • 4 comments

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

NicolasReyDotNet avatar Jan 21 '20 16:01 NicolasReyDotNet

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

vwxyzh avatar Feb 12 '20 02:02 vwxyzh

@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 avatar Mar 05 '20 04:03 sffamily

@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?

gerb0n avatar Sep 25 '20 21:09 gerb0n

Hi @sffamily. Are there any news regarding this upcoming feature?

sboutsis avatar Sep 16 '21 10:09 sboutsis