Exa
Exa

Reputation: 181

aiohttp websocket EOfStream handling

I'm connecting to a websocket endpoint using aiohttp's default WebsocketProtocol and out of the blue (after some time and multiple infinite loop iterations) I always get WSMsgType.ERROR with EofStream as data. To my understanding, this should not happen. I tried researching how to deal with this but have been relatively unsuccessful. Should I just close and reconnect to the endpoint? Is there a way to ensure this doesn't happen? Should I implement a specific handling algorithm?

Upvotes: 2

Views: 314

Answers (1)

Andrew Svetlov
Andrew Svetlov

Reputation: 17366

It means connection closed by peer. Internet is unstable transport, you should always be prepared to such situations. Usually reconnection helps in cases like this.

Upvotes: 1

Related Questions