简体   繁体   中英

Automatically reconnect a Python Tornado Websocket Client Connection

I am using Python Tornado's websocket_connect function ( http://tornadokevinlee.readthedocs.org/en/latest/websocket.html ) to listen to a websocket feed.

Sometimes the websocket server will die, or disconnect the client (this is detectable ) and I need to figure out a way to clean up the old connection and reconnect the client. I could of course just restart the program but what is the proper way to do this through tornado?

There's nothing automatic for this. When it disconnects, just call websocket_connect() again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM