docs: update website
This commit is contained in:
39
README.md
39
README.md
@@ -22,7 +22,7 @@ See also: [Socket.IO-client Java](https://github.com/socketio/socket.io-client-j
|
||||
| -------------- | ---------------- | ---------------- |
|
||||
| 0.9.x | 1.x | 1.x |
|
||||
| 1.x | 3.x | 2.x |
|
||||
| - | 4.x | 3.x |
|
||||
| WIP | 4.x | 3.x |
|
||||
|
||||
## Installation
|
||||
The latest artifact is available on Maven Central.
|
||||
@@ -132,43 +132,6 @@ socket = new Socket(opts);
|
||||
## Features
|
||||
This library supports all of the features the JS client does, including events, options and upgrading transport. Android is fully supported.
|
||||
|
||||
### Extra features only for Java client
|
||||
|
||||
#### Accessing HTTP Headers
|
||||
You can access HTTP headers like the following.
|
||||
|
||||
```java
|
||||
socket.on(Socket.EVENT_TRANSPORT, new Emitter.listener() {
|
||||
@Override
|
||||
public void call(Object... args) {
|
||||
// Called on a new transport created.
|
||||
Transport transport = (Transport)args[0];
|
||||
|
||||
transport.on(Transport.EVENT_REQUEST_HEADERS, new Emitter.Listener() {
|
||||
@Override
|
||||
public void call(Object... args) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, List<String>> headers = (Map<String, List<String>>)args[0];
|
||||
// send cookie value to server.
|
||||
headers.put("Cookie", Arrays.asList("foo=1;"));
|
||||
}
|
||||
}).on(Transport.EVENT_RESPONSE_HEADERS, new Emitter.Listener() {
|
||||
@Override
|
||||
public void call(Object... args) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, List<String>> headers = (Map<String, List<String>>)args[0];
|
||||
// receive cookie value from server.
|
||||
String cookie = headers.get("Set-Cookie").get(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
See the Javadoc for more details.
|
||||
|
||||
http://socketio.github.io/engine.io-client-java/apidocs/
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
|
||||
Reference in New Issue
Block a user