Hi,
I use Sails and socket.io. I try to use your lib to connect my Android application with my server but I have a 403 cause I'm not login. How can I send the correct header to be logged with this library. I didn't find anything on the doc about this.
An example of accessing http headers. I noted this on READEME.
socket.io().on(Manager.EVENT_TRANSPORT, new new Emitter.listener() {
@Override
public void call(Object... args) {
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];
// modify request headers
headers.put("Cookie", Arrays.asList("foo=1;"));
}
});
transport.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];
// access response headers
String cookie = headers.get("Set-Cookie").get(0);
}
});
}
});
Thanks ^^ it's perfect ! No more 403 ^^
Does this still apply on newer version? @nkzawa
yes it does