Uses 211K of libraries. Click here for Pure Java version (3229L/18K).
!include once #1015699 // websocket svoid webSocketTest(S url) ctex { print("Connecting to " + url); WebSocketClient client = new(new URI(url)) { public void onMessage(S s) { print("Received: " + s); } public void onOpen(ServerHandshake handshake) { print("WebSocket opened"); } public void onClose(int code, S reason, bool remote) { print("WebSocket closed"); } public void onError(Exception e) { printStackTrace(e); } }; client.connect(); afterwards { client.close(); } sleepSeconds(60); }
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx
No comments. add comment
| Snippet ID: | #1032381 |
| Snippet name: | webSocketTest - connects for 60s and prints all received messages to console |
| Eternal ID of this version: | #1032381/3 |
| Text MD5: | 7b4b1cc50332f3129331f91fdcf391a5 |
| Transpilation MD5: | 1481b2b58653f905938f30c560c37fad |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2021-09-02 02:47:59 |
| Source code size: | 569 bytes / 21 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 397 / 473 |
| Version history: | 2 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1036022 - PrintingWebSocketClient |