update README
This commit is contained in:
23
README.md
23
README.md
@@ -13,7 +13,7 @@ socket = IO.socket("http://localhost");
|
|||||||
socket.on(Socket.EVENT_CONNECT, new Emitter.Listener() {
|
socket.on(Socket.EVENT_CONNECT, new Emitter.Listener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void call(Object... objects) {
|
public void call(Object... args) {
|
||||||
socket.emit("foo", "hi");
|
socket.emit("foo", "hi");
|
||||||
socket.disconnect();
|
socket.disconnect();
|
||||||
}
|
}
|
||||||
@@ -21,17 +21,34 @@ socket.on(Socket.EVENT_CONNECT, new Emitter.Listener() {
|
|||||||
}).on("event", new Emitter.Listener() {
|
}).on("event", new Emitter.Listener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void call(Object... objects) {}
|
public void call(Object... args) {}
|
||||||
|
|
||||||
}).on(Socket.EVENT_DISCONNECT, new Emitter.Listener() {
|
}).on(Socket.EVENT_DISCONNECT, new Emitter.Listener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void call(Object... objects) {}
|
public void call(Object... args) {}
|
||||||
|
|
||||||
});
|
});
|
||||||
socket.connect();
|
socket.connect();
|
||||||
```
|
```
|
||||||
|
|
||||||
|
This Library uses [Gson](https://code.google.com/p/google-gson/) to parse and compose JSON strings:
|
||||||
|
|
||||||
|
```java
|
||||||
|
// Sending an object
|
||||||
|
JsonObject obj = new JsonObject();
|
||||||
|
obj.addProperty("hello", "server");
|
||||||
|
socket.emit("foo", obj);
|
||||||
|
|
||||||
|
// Receiving an object
|
||||||
|
socket.on("foo", new Emitter.Listener() {
|
||||||
|
@Override
|
||||||
|
public void call(Object... args) {
|
||||||
|
JsonObject obj = (JsonObject)args[0];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
Options are supplied as follow:
|
Options are supplied as follow:
|
||||||
|
|
||||||
```java
|
```java
|
||||||
|
|||||||
Reference in New Issue
Block a user