Alpaca and polygon sockets close without information

Using c# api. I find the sockets close multiple times a day. Both the alpaca and polygon sockets. The stream socket closed event provides no information about what the data stopped.
When this happens, waiting a few milliseconds and opening again tends not to work.
How do I manage this unreliable situation?
Thank you,