update README
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
# Socket.IO-client.java
|
# Socket.IO-client.java
|
||||||
[](https://travis-ci.org/nkzawa/socket.io-client.java)
|
[](https://travis-ci.org/nkzawa/socket.io-client.java)
|
||||||
|
|
||||||
This is the Socket.IO v1.0 Client Library for Java, which is simply ported from the [JS client](https://github.com/LearnBoost/socket.io-client).
|
This is the Socket.IO v1.0 Client Library for Java, which is simply ported from the [JavaScript client](https://github.com/LearnBoost/socket.io-client).
|
||||||
|
|
||||||
See also: https://github.com/nkzawa/engine.io-client.java
|
See also: [Engine.IO-client.java](https://github.com/nkzawa/engine.io-client.java)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
Socket.IO-client.java has almost the same api and features with the original JS client. You use `IO#socket` to initialize `Socket`:
|
Socket.IO-client.java has almost the same api and features with the original JS client. You use `IO#socket` to initialize `Socket`:
|
||||||
@@ -32,16 +32,17 @@ socket.on(Socket.EVENT_CONNECT, new Emitter.Listener() {
|
|||||||
socket.connect();
|
socket.connect();
|
||||||
```
|
```
|
||||||
|
|
||||||
`Options` are supplied as follow:
|
Options are supplied as follow:
|
||||||
|
|
||||||
```java
|
```java
|
||||||
IO.Options opts = new IO.Options();
|
IO.Options opts = new IO.Options();
|
||||||
opts.forceNew = true;
|
opts.forceNew = true;
|
||||||
|
opts.cookie = "foo=1;";
|
||||||
|
|
||||||
socket = IO.socket("http://localhost", opts);
|
socket = IO.socket("http://localhost", opts);
|
||||||
```
|
```
|
||||||
|
|
||||||
You can get a callback with the `Ack`:
|
You can get a callback with `Ack` when the server received a message:
|
||||||
|
|
||||||
```java
|
```java
|
||||||
socket.emit("foo", "woot", new Ack() {
|
socket.emit("foo", "woot", new Ack() {
|
||||||
|
|||||||
Reference in New Issue
Block a user