how to close PubSub connections on demand

Zongwen Feng 21 Reputation points
2021-09-01T17:43:56.66+00:00

Since PubSub has a connection limit count, I want to manage the connections and close the ones that is not needed any more. This is necessary as we can't depend on the client side to close the connection voluntarily.

I am ware that through the WebHook, I can collect all the connection IDs on the event [azure.webpubsub.sys.connected], and then I can choose to close some connections as needed. However, I will have to maintain those connection IDs.

Is there any way to close all the connections for a given UserId? The SDK only provides the capability to close a connection by connection ID.

Alternatively, is there a way to get the list of active connections for a given User ID? I really don't want to maintain those connection IDs. It feels like it should be the responsibility of the PubSub service.

Thanks!

Azure Web PubSub
Azure Web PubSub
An Azure service that provides real-time messaging for web applications using WebSockets and the publish-subscribe pattern.
58 questions
0 comments No comments
{count} votes

Accepted answer
  1. Chenyang Liu 151 Reputation points
    2021-09-02T03:32:08.963+00:00

    Currently, we don't provide mechanism to close by user-id or get connection-id by user-id. But we think it makes sense to provide a RestAPI to close by user-id. We will put it on our roadmap.


0 additional answers

Sort by: Most helpful