Skip to main content

Why do Polygon WebSocket disconnects happen?

Updated over 2 years ago

WebSocket disconnects can occur for a variety of reasons. Usually, a disconnect means the market data isn’t being consumed fast enough. There is a server-side buffer and if it fills, the connection will be delayed and then killed. The best way to mitigate this is to read the packets off of the network and immediately put them into a queue. Have a separate thread which is parsing the messages and running any logic on them. We also recommend using a multi threaded language like GoLang or C# to stream large amounts of data. This tends to work better than single threaded languages like Python. You can always check the buffer limit in the connections tab in your dashboard.

Feel free to reach out to support@polygon.io for any additional assistance!

Did this answer your question?