Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

20
LINES

< > BotCompany Repo | #1036022 // PrintingWebSocketClient

JavaX fragment (include) [tags: use-pretranspiled]

Uses 211K of libraries. Click here for Pure Java version (9212L/51K).

!include once #1015699 // websocket

sclass PrintingWebSocketClient extends WebSocketClient {
  *(URI uri) { super(uri); }
  *(URI uri, SS httpHeaders) { super(uri, httpHeaders); }
  
  public void onMessage(S s) {
    print("WebSocket received: " + s);
  }

  public void onOpen(ServerHandshake handshake) {
    print("WebSocket opened");
  }
  
  public void onClose(int code, S reason, bool remote) {
    print("WebSocket closed, code " + code + ", reason: " + reason + ", remote: " + remote);
  }
  
  public void onError(Exception e) { printStackTrace(e); }
}

Author comment

Began life as a copy of #1032381

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): elmgxqgtpvxh, mqqgnosmbjvj, wnsclhtenguj

No comments. add comment

Snippet ID: #1036022
Snippet name: PrintingWebSocketClient
Eternal ID of this version: #1036022/2
Text MD5: 1d14dbbedf10356b33da09cd0d43f12a
Transpilation MD5: 19fbf8e2f16c54909666a87b4c1d8db5
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-09-01 12:58:26
Source code size: 583 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 63 / 94
Version history: 1 change(s)
Referenced in: [show references]