package com.example.android_websocketclient_test; import java.net.URI; import org.java_websocket.client.WebSocketClient; import org.java_websocket.drafts.Draft; import org.java_websocket.handshake.ServerHandshake; import android.util.Log; public class EmptyClient extends WebSocketClient{ public EmptyClient(URI serverUri, Draft draft) { super(serverUri, draft); } public EmptyClient(URI serverURI) { super(serverURI); } @Override public void onOpen(ServerHandshake handshakedata) { Log.d("test app","new connection opened"); System.out.println("new connection opened"); } @Override public void onClose(int code, String reason, boolean remote) { System.out.println("closed with exit code " + code + " additional info: " + reason); } @Override public void onMessage(String message) { System.out.println("received message: " + message); } @Override public void onError(Exception ex) { System.err.println("an error occurred:" + ex); } }
public static void main(String[] args) throws URISyntaxException { WebSocketClient client = new EmptyClient(new URI("ws://10.0.2.2:15"), new Draft_10()); client.connect(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)