Skip to content

Commit 08a7b34

Browse files
committed
added missing example
1 parent e256ec5 commit 08a7b34

2 files changed

Lines changed: 41 additions & 0 deletions

File tree

example/AutobahnServerTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public void onOpen( WebSocket conn, ClientHandshake handshake ) {
2828

2929
@Override
3030
public void onClose( WebSocket conn, int code, String reason, boolean remote ) {
31+
System.out.println( "closed" );
3132
}
3233

3334
@Override

example/ExampleClient.java

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import java.net.URI;
2+
import java.net.URISyntaxException;
3+
4+
import org.java_websocket.WebSocketClient;
5+
import org.java_websocket.drafts.Draft;
6+
import org.java_websocket.drafts.Draft_10;
7+
import org.java_websocket.handshake.ServerHandshake;
8+
9+
public class ExampleClient extends WebSocketClient {
10+
11+
public ExampleClient( URI serverUri , Draft draft ) {
12+
super( serverUri, draft );
13+
}
14+
15+
public ExampleClient( URI serverURI ) {
16+
super( serverURI );
17+
}
18+
19+
@Override
20+
public void onOpen( ServerHandshake handshakedata ) {
21+
}
22+
23+
@Override
24+
public void onMessage( String message ) {
25+
}
26+
27+
@Override
28+
public void onClose( int code, String reason, boolean remote ) {
29+
}
30+
31+
@Override
32+
public void onError( Exception ex ) {
33+
}
34+
35+
public static void main( String[] args ) throws URISyntaxException {
36+
ExampleClient c = new ExampleClient( new URI( "ws://localhost:8887" ), new Draft_10() );
37+
c.connect();
38+
}
39+
40+
}

0 commit comments

Comments
 (0)