Updates from pi
This commit is contained in:
@ -1,3 +1,6 @@
|
||||
var ws_index = 0
|
||||
const ws_address_list = ["ws://192.168.4.1:8080", "ws://192.168.1.130:8080", "ws://tropicananass.ovh:8080"]
|
||||
|
||||
function wait_reconnection() {
|
||||
--timeout;
|
||||
document.getElementById("time-left").innerHTML = timeout + "s";
|
||||
@ -8,7 +11,15 @@ function wait_reconnection() {
|
||||
}
|
||||
|
||||
function reconnect() {
|
||||
socket = new WebSocket("ws://tropicananass.ovh:8080");
|
||||
// for (i in ws_address_list) {
|
||||
// console.log("try to connect " + ws_address_list[i])
|
||||
// try {
|
||||
socket = new WebSocket(ws_address_list[ws_index]);
|
||||
// } catch (error) {
|
||||
// console.error("failed to connect to " + ws_address_list[i] + "\n" + error);
|
||||
// }
|
||||
// }
|
||||
// socket = new WebSocket("ws://192.168.1.130");
|
||||
timeout = 60;
|
||||
|
||||
socket.onopen = function(e) {
|
||||
@ -47,5 +58,10 @@ function reconnect() {
|
||||
|
||||
socket.onerror = function(error) {
|
||||
console.log(`[error] ws: ${error.message}`);
|
||||
++ws_index;
|
||||
if (ws_index >= ws_address_list.length) {
|
||||
ws_index = 0;
|
||||
}
|
||||
document.getElementById("ws-input").elements["ws-selection"][ws_index].checked = true;
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user