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.
CodePudding user response:
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."