0

Is there any way to know whether ClientWebSocket connection is closed/disconnected? I am using slack RTM api in C# and sometimes due to connectivity issues connection is closed from server, then I want to retry connection.

I am connecting to websocket server like this

var client = new ClientWebSocket();
client.ConnectAsync(url, token);
Rushi Soni
  • 1,008
  • 1
  • 12
  • 20
  • It is not the same way that most async socket science works; upon disconnect the delegate attached to the receive event runs, but receives 0 bytes? – Caius Jard Sep 05 '17 at 12:47
  • A websocket uses TCP as the transport layer. So following posting may help : https://stackoverflow.com/questions/1387459/how-to-check-if-tcpclient-connection-is-closed – jdweng Sep 05 '17 at 12:50

0 Answers0