{T: 'error', code: 406, msg: 'connection limit exceeded'}

I get an error when I try to use the market data API
error 406
“connection limit exceeded”
what should i do??

This message is documented here. Most probably you have another connection with the same API key/secret opened. Only one active real-time connection is allowed now. The server has 90 seconds timeout for ‘partially dead’ connections so if you try to reconnect right after network-related disconnection (without proper web socket shutdown) using another socket you will receive this message too.

3 Likes

can you give an example of how to close WebSocket in a proper way?

@chatofking Proper network resource closing depends on your programming language/library. In most cases, socket-related objects provide a method/function for closing the underlying connection. It can have names like close, disconnect, or something like this. Ideally, it should send a low-level WS protocol message to the server that indicates the end of the communication session and close the network socket after receiving a confirmation response from the server side.

1 Like