Uses 211K of libraries. Click here for Pure Java version (10763L/61K).
!include once #1015699 // websocket sclass FlexWebSocketClient extends WebSocketClient { *(URI uri) { super(uri); } *(URI uri, SS httpHeaders) { super(uri, httpHeaders); } settable bool verbose; event opened(ServerHandshake handshake); event gotMessage(S message); event gotBinaryMessage(java.nio.ByteBuffer message); event closed(CloseInfo info); event error(Exception error); record noeq CloseInfo(int code, S reason, bool remote) {} public void onMessage(S s) { if (verbose) print("WebSocket received: " + s); gotMessage(s); } public void onMessage(java.nio.ByteBuffer bytes) { if (verbose) print("WebSocket received " + nBytes(bytes.remaining()); gotBinaryMessage(bytes); } public void onOpen(ServerHandshake handshake) { if (verbose) print("WebSocket opened"); opened(handshake); } public void onClose(int code, S reason, bool remote) { if (verbose) print("WebSocket closed, code " + code + ", reason: " + reason + ", remote: " + remote); closed(new CloseInfo(code, reason, remote)); } public void onError(Exception e) { printStackTrace(e); error(e); } }
Began life as a copy of #1036022
download show line numbers debug dex old transpilations
Travelled to 2 computer(s): mqqgnosmbjvj, wnsclhtenguj
No comments. add comment
Snippet ID: | #1036596 |
Snippet name: | FlexWebSocketClient |
Eternal ID of this version: | #1036596/6 |
Text MD5: | b81e87e64ddb467b70ba105d0748b407 |
Transpilation MD5: | e3a288c0f0881d41ee8d04af52171c7c |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2023-09-03 13:58:25 |
Source code size: | 1198 bytes / 41 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 220 / 304 |
Version history: | 5 change(s) |
Referenced in: | #1003674 - Standard Classes + Interfaces (LIVE continued in #1034167) |