I am experimenting a bit with WebSockets and Java. According to the latest WebSocket project, a message can be a binary or a simple string. I use a Webbit server and has two functions:
public void onMessage(WebSocketConnection connection, String message) public void onMessage(WebSocketConnection connection, byte[] message)
I wonder what the difference is. Is byte [] fast? Or why does it matter? I can write everything that I write with bytes, because even a string consists of bytes during transmission, so why do we have two different methods? Only Google Chrome 15 Beta and 16 Dev supports binary transfer, so I thought about using Base64 encoding / decoding on both the client and server. Is this the only difference? What if I just read every byte, put them in a string and send them? I think the only difference will be that not all bytes are string characters, so will I just add the overhead when converting to a string?
tl; dr → What is the difference between binary wrapping and line wrapping?
source share