gimite / web-socket-js

HTML5 Web Socket implementation powered by Flash
BSD 3-Clause "New" or "Revised" License
2.73k stars 489 forks source link

Connection is closed before receiving all messages... #166

Closed ddeath closed 9 years ago

ddeath commented 9 years ago

Hi there,

I have defined onmessage function which print console.log('onmessage'); same for onclose... console.log("onclose");

Then I am sending some data from server, 2 messages, first is small and second can be small but also large

When both messages are small, console will output: onmessage onmessage onclose

however if second is large, often it ends up: onmessage onclose

and the large message is gone, but if I check google chrome`s developer tool (network tab) I can see that second, large message is there...

So I guess that websocket client does not wait for message to be fully received....

gimite commented 9 years ago

Sorry for slow response. Do you use Chrome? Do you set WEB_SOCKET_FORCE_FLASH = true? Otherwise web-socket-js does nothing, just uses native WebSocket implementation. So the issue is not specific to web-socket-js.

I'm not sure what exactly the spec is for such timing issue, but how about closing the connection from the client side first, and let the server close the connection only when the client is disconnected?

ddeath commented 9 years ago

Thanks for response. Yes I use google chrome. I do not set WEB_SOCKET_FORCE_FLASH, my server is not set up for that type of connection.

Also thanks for suggestion :)