Issue reconnecting websocket from client side

Hi all, I’m trying to improve my app’s resiliency against dropped websocket connections and I’m hitting a roadblock. I’m on a paid subscription, and I’m able to establish connections to the trades stream wss://api.alpaca.markets/stream and the data stream wss://stream.data.alpaca.markets/v2/sip. Everything works well until my local connection is reset (ie. unplugging my ethernet and jumping to wifi, which is already connected). As I understand it, this forces a new TCP connection which other networked apps detect and deal with under the hood.

The problem is that when this connection reset is detected in my Python app, the reconnection attempt returns a 406-Rate limit exceeded error immediately, but only on the market data websocket connection. The trades websocket is able to reconnect without issue.

My hunch is this is due to the single connection limit referenced in the documentation for the market data API. I’ve found no such limitation for the trades API. Since the connection is dropped on the client side, I’m guessing the server is left with an orphaned session.

Is it possible to define a session timeout that the server will honor when establishing the initial connection? I’ve read through Polygon’s API doc and I believe in this situation that system will terminate the old session instead of denying the new one, but I haven’t tested this (don’t have a subscription).

Thanks for any insights…