Download Jar. Libraryless. Click here for Pure Java version (2798L/19K).
!7 static Map<O, Long> wsToState = weakHashMap(); static int interval = 200, initialChars = 65536; //static long timeout = 10*60000L; // larger timeout since we have no idle mechanism yet (todo) static long timeout = 30000+10000; // idle time + latency static File fileToLog() { ret mechVersionsLog(); } p { webSocketManager = new WebSocketManager { void onNewWebSocket(O ws, S uri) { super.onNewWebSocket(ws, uri); set(ws, 'timeout, timeout); } void onWebSocketMessage(O ws, S s) { File f = fileToLog(); long len = fileSize(f); new Matches m; if "look back * chars pw *" // TODO: filter if it appears in Eleu log if (neq(masterPW(), $2)) { call(ws, 'send, "bad pw"); call(ws, 'close); } else wsToState.put(ws, max(0, len-parseLong($1))); } }; doEvery(interval, f update); } html { ret "Use WebSocket: " + subBot_myWebSocketURI(); } svoid update { if (webSocketManager.isEmpty()) ret; File f = fileToLog(); long len = fileSize(f); for (O ws : webSocketManager.webSockets()) { Long l = wsToState.get(ws); if (l != null && len > l) { // no cmd yet? ignore S newStuff = unquoteAllLines(loadTextFilePart(f, l, len)); wsToState.put(ws, len); call(ws, 'send, "+" + newStuff); } } }
Began life as a copy of #1014682
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1015684 |
Snippet name: | Mech Changes Log For Programs (dev., LIVE) |
Eternal ID of this version: | #1015684/11 |
Text MD5: | 5d5b947b8f9b20afc61e138e08182980 |
Transpilation MD5: | a3f77888bace6a0f21d38d8337d108b3 |
Author: | stefan |
Category: | javax / a.i. / web |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-06-18 19:05:05 |
Source code size: | 1378 bytes / 47 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 546 / 2561 |
Version history: | 10 change(s) |
Referenced in: | [show references] |