Connecting Azure Web PubSub Client Disconnects others

Phil Wardlaw 1 Reputation point
2022-05-17T23:04:37.05+00:00

Reposting from here https://stackoverflow.com/questions/72281176/connecting-azure-web-pubsub-client-disconnects-others

I have a scenario where I have 2 c# ClientWebSocket connected to an azure Web PubSub. They can communicate fine. I then disconnect client 2 (call CloseAsync()). The Azure web trigger for disconnect works, and informs client 1 that client 2 has disconnected. I then connect client 2 again and client 1 will abort. Catching an exception in client 1's receive loop says the ssl stream has been disposed. I did not call abort or dispose on client 1. I assume this is because Azure is closing the connection service side...

Any ideas why this is happening or how to fix this? I would like clients to be able to join and leave as they please.

Perhaps it has something to do with me making several client connections from the same machine?

Azure Web PubSub
Azure Web PubSub
An Azure service that provides real-time messaging for web applications using WebSockets and the publish-subscribe pattern.
59 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,205 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Phil Wardlaw 1 Reputation point
    2022-05-19T20:15:26.363+00:00

    There was no issue with Azure WebPubSub.

    I was making multiple calls to System.Net.WebSockets.SendAsync which makes it abort. As documented "Exactly one send and one receive is supported on each ClientWebSocket object in parallel."