Unexpected terminate of Web Socket connection [3001 (registered) illegal request]

websockets.exceptions.ConnectionClosedError: received 3001 (registered) illegal request; then sent 3001 (registered) illegal request
Hi, could you please explain me this issue? I can’t find something similar from other forum users.

I use a lot of socket connections, but I take into account all the explicit limitations of the API

It might be related with handling of ping frames.
API documentation has:

  • The websocket server will send a ping frame every 3 minutes. If the websocket server does not receive a pong frame back from the connection within a 10 minute period, the connection will be disconnected. Unsolicited pong frames are allowed.

If you respond the received ping frame with a incorrect message format, the disconnection can happen.

Thanks a lot. I’ll try to handle this case

1 Like