forked from socketio/socket.io-client-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConnection.java
More file actions
24 lines (20 loc) · 713 Bytes
/
Copy pathConnection.java
File metadata and controls
24 lines (20 loc) · 713 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package io.socket.client.executions;
import io.socket.emitter.Emitter;
import io.socket.client.IO;
import io.socket.client.Socket;
import java.net.URISyntaxException;
public class Connection {
public static void main(String[] args) throws URISyntaxException {
IO.Options options = new IO.Options();
options.forceNew = true;
final Socket socket = IO.socket("http://localhost:" + System.getenv("PORT"), options);
socket.on(Socket.EVENT_CONNECT, new Emitter.Listener() {
@Override
public void call(Object... args) {
System.out.println("connect");
socket.close();
}
});
socket.open();
}
}