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

28
LINES

< > BotCompany Repo | #1014686 // WebSocket Client Test 2 (OK, but no auto-reconnect)

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Uses 115K of libraries. Click here for Pure Java version (949L/7K/24K).

!7

lib 1014685 // websocket

import org.java_websocket.client.WebSocketClient;
import org.java_websocket.handshake.ServerHandshake;

p {
  WebSocketClient client = new WebSocketClient(new URI("ws://butter.botcompany.de:8080/1014677")) {
    public void onMessage( String message ) {
      print("message from server: " + message);
    }

    public void onOpen( ServerHandshake handshake ) {
      print("opened connection");
    }

    public void onClose(int code, S reason, bool remote) {
      print("closed connection");
    }

    public void onError(Exception e) {
      printStackTrace(e);
    }
  };
  
  assertTrue("connect", client.connectBlocking());
}

Author comment

Began life as a copy of #1009221

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1014686
Snippet name: WebSocket Client Test 2 (OK, but no auto-reconnect)
Eternal ID of this version: #1014686/3
Text MD5: 09c00b534b57cb1ba18e91a5f275f6fb
Transpilation MD5: 482661c301421ce0c32ec3eaa9de7c5b
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-04-30 01:19:26
Source code size: 692 bytes / 28 lines
Pitched / IR pitched: No / No
Views / Downloads: 387 / 493
Version history: 2 change(s)
Referenced in: [show references]