update README

This commit is contained in:
Naoyuki Kanezawa
2014-07-13 16:23:32 +09:00
parent 98a3eb8777
commit 65baf06eae
2 changed files with 20 additions and 2 deletions

View File

@@ -13,11 +13,13 @@ The latest artifact is available on Maven Central. Add the following dependency
<dependency>
<groupId>com.github.nkzawa</groupId>
<artifactId>socket.io-client</artifactId>
<version>0.1.1</version>
<version>0.1.2</version>
</dependency>
</dependencies>
```
Or to install it manually, please refer dependencies to [pom.xml](https://github.com/nkzawa/socket.io-client.java/blob/master/pom.xml).
## Usage
Socket.IO-client.java has almost the same api and features with the original JS client. You use `IO#socket` to initialize `Socket`:
@@ -51,6 +53,7 @@ This Library uses [org.json](http://www.json.org/java/) to parse and compose JSO
// Sending an object
JSONObject obj = new JSONObject();
obj.put("hello", "server");
obj.put("binary", new byte[42]);
socket.emit("foo", obj);
// Receiving an object
@@ -81,10 +84,25 @@ socket.emit("foo", "woot", new Ack() {
});
```
Use custom SSL settings:
```java
// default SSLContext for all sockets
IO.setDefaultSSLContext(mySSLContext);
// set as an option
opts = new IO.Options();
opts.sslContext = mySSLContext;
socket = IO.socket("https://localhost", opts);
```
See the Javadoc for more details.
http://nkzawa.github.io/socket.io-client.java/apidocs/
## Features
This library supports all of the features the JS client does, including events, options and upgrading transport. Android is fully supported.
## License
MIT