Sending and Receiving Binary Data - Atmosphere/wasync Wiki

To send and receive binary data using wAsync, you need to set the RequestBuilder's content-type to

request = client.newRequestBuilder()
                .method(Request.METHOD.GET)
                **.header("Content-Type", "application/octet-stream")**

You must add this header, because Atmosphere ignore content-type

X-Atmosphere-Binary: true

See Atmosphere

Starting with 1.3.0, you can also set the OptionsBuilder.binary(true) in order to turn on binary support

socket = client.create(client.newOptionsBuilder().binary(true).build());

Then you can define a Decoder that accept bytes

socket.on("message", new Function<byte[]>() {
        @Override
        public void on(byte[] message) {
           ...
        }
})