satoshinm / NetCraft

Web-based fork of fogleman/Craft ⛺
https://satoshinm.github.io/NetCraft/
MIT License
56 stars 13 forks source link

Automatic re-connect interval if disconnected? #171

Open satoshinm opened 7 years ago

satoshinm commented 7 years ago

The server connection can be lost for various reasons, such as if you are on a mobile device and lose connectivity. Reconnecting requires typing /online servername (if you have a keyboard) or reloading the page (losing state). What about automatically trying to reconnect to the server at some repeating interval, if the connection is lost? src/main.c:

void client_closed(int fd, void *userData) {
    add_message("Client closed the connection");
    client_disable();
}
satoshinm commented 7 years ago

Found this (but it is JavaScript): https://github.com/joewalnes/reconnecting-websocket - "after an onclose event is called it will automatically attempt to reconnect" repeatedly (with a small pause) - 1 second intervals