3

I am using WebSocketSharp to receive a stream from a service in C#. So basically I have some code like this.

WebSocket webSocket = new WebSocket("wss://ws-feed....");
webSocket.Connect();
webSocket.Send("message");
//Do something
//Data still being received
Console.Write("What happens if I break indefinitely here?");

What I am wondering is what happens to messages received while the WebSocket is in a long breakpoint for instance at the last line in the above example?

I assume it is implementation specific but based on my observations it appears that messages are queued and released once the breakpoint is exited. However I assume there must be some cap on how many messages can be queued prior to messages starting to be dropped.

So, what is the typical behavior of a WebSocket library while it has encountered a breakpoint? Are messages indefinitely queued or will they eventually be dropped? Should any specific precautions be taken while debugging to ensure you are seeing the data as it would behave in release mode?

Maxim Gershkovich
  • 45,951
  • 44
  • 147
  • 243
  • 1
    Wouldn't the incoming messages just sit in the incoming TCP buffer in the OS waiting for the program to read them? There's a limit and that buffer could fill up in which case the local TCP stack would flow control the sender. Debugging real-time code accurately generally has to be done with instrumentation and logging, not with breakpoints because using breakpoints will change the relative timing of some operations. – jfriend00 Mar 22 '18 at 02:24

0 Answers0