I am making a little experiment with WebSockets and Java. Apperantly, according to the last draft of WebSocket, the message can be binary or a plain string. I use Webbit server and it has two functions:
public void onMessage(WebSocketConnection connection, String message)
public void onMessage(WebSocketConnection connection, byte[] message)
I wonder what makes a difference. Is byte[] faster? Or why does it matter? I can write everything I write with the bytes because even a string is composed into bytes while transfer, so why do we have two multiple methods? Only Google Chrome 15 Beta and 16 Dev supports binary transfer, so I was thinking of using Base64 encoding/decoding on both client and server. Is this the only difference? What if I just read each byte, compose them into a string and send them? I think, only difference will be that not all bytes are String chars, so I wouuld just add an overhead when converting to a String?
tl;dr -> What is the difference between Binary transfer and String transfer?