question

PhilWardlaw-3278 avatar image
0 Votes"
PhilWardlaw-3278 asked Grmacjon-MSFT commented

Connecting Azure Web PubSub Client Disconnects others

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?

dotnet-csharpazure-web-pubsub
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

PhilWardlaw-3278 avatar image
0 Votes"
PhilWardlaw-3278 answered Grmacjon-MSFT commented

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."

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi PhilWardlaw-3278,

Thanks for the update and sharing the solution that worked for you.

Best,
Grace

0 Votes 0 ·