We have created the webhooks for /connect and /connected in our server and we get those endpoints called when client connects to pubsub using websocket. We want to add the connected user to be added to certain pubsub groups and we do that in /connected webhook. The problem is sometimes the pubsub rest api throws User not found error when trying to add the user to a group.
If addition of user to the group fails, the server disconnects the current connection and the client reconnects. This is resulting in an endless loop of client reconnection since the pubsub rest api constantly throws "User not found" in /connected webhook.
Solutions we have tried:
Add user to group in /connect endpoint instead of /connected. Same error gets thrown.
Add connection to group instead of user. We are currently monitoring that and would get back with our observation.
Note: The server is not using pubsub rest api directly. Its using azure messaging python sdk. Rest api here