Initial reconnect best practices #998
-
Initial reconnection does not seem to be implemented in the library as mentioned in this old issue. Still, I would like to ask for the best practices for handling the reconnection behavior in your application. Currently, I'm checking for a connection error and exiting the application if the connection cannot be established (the application is automatically restarted). try:
sio.connect(
"https://DOMAIN/",
socketio_path="/socket.io",
headers={"x-auth-token": TOKEN},
)
except socketio.exceptions.ConnectionError:
sys.exit('Initial connection to Socket.IO server failed') Are there any best practices for this behavior, or is there a plan to implement the initial reconnection functionality? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
What I've seen people do is put the connect call in a for or while loop:
I'm not opposed to adding something like this as an option. Will definitely consider it when I look at #485, but that one is also lowish priority in my queue. |
Beta Was this translation helpful? Give feedback.
What I've seen people do is put the connect call in a for or while loop:
I'm not opposed to adding something like this as an option. Will definitely consider it when I look at #485, but that one is also lowish priority in my queue.