!7 static long timeout = 30000+10000; // idle time + latency static int theNumber; p { webSocketManager = new WebSocketManager { void onNewWebSocket(O ws, S uri) { super.onNewWebSocket(ws, uri); set(ws, 'timeout, timeout); update(); } void onWebSocketClosed(O ws) { super.onWebSocketClosed(ws); update(); } void onWebSocketMessage(O ws, S s) {} }; //doEvery(interval, f update); } html { ret "Use WebSocket: " + subBot_myWebSocketURI(); } svoid sendNumber(O ws) { call(ws, 'send, str(theNumber)); } svoid update { if (webSocketManager.isEmpty()) ret; L sockets = webSocketManager.webSockets(); theNumber = l(sockets); for (O ws : sockets) pcall { sendNumber(ws); } }