Reputation: 8768
What does it mean, when an in-browser websocket object receives a onmessage event with the message data length equal to 0?
specifically I use Safari as websocket client (Hixie). The client code is nothing special.
socket = new WebSocket(host); socket.onmessage = function(msg) { log("Received: "+msg.data.length); if(msg.data.length > 0) ... processing };
The server is based on PHP, and messages are sent without errors.
Upvotes: 1
Views: 867
Reputation: 73119
I think this is just a Safari annoyance. The current released versions of Safari implement the older WebSockets protocol version and the implementation works but it is a bit lacking. The 0 length messages issue is pretty tame. A more serious issue is the inability to properly close a connection (basically doesn't close the actual socket until the page is reloaded).
Try the same test with a recent Chrome. If you don't see the problem there then it's just a Safari issue. If you still see 0 length messages, then it is likely that the PHP websocket server is sending 0 length messages (perhaps as a sort of poor man keep-alive).
Upvotes: 0