When using websockets I noticed some message loss. I am trying to communicate between mobile safari (client) and c#(server). I am using superWebSocket (opensource) as a server, so it might be a server bug...
But the messages are only dropped when the connection is congested (When I send alot of messages). This "reaks" of UDP to me, but I remember reading somewhere that web-sockets are TCP.
Is there any occasion where I might issue a "send" command in javascript, and the receiving side does not get the message?
Websocket client connections may drop due to intermittent network issue and when connections drop, messages will also be lost.
The biggest downside to using WebSocket is the weight of the protocol and the hardware requirements that it brings with it. WebSocket requires a TCP implementation, which may or may not be a problem, but it also requires an HTTP implementation for the initial connection setup.
It has built-in means of detecting transmission errors or packet corruption and attempting retransmissions in those cases, but delivery can still fail. It guarantees that if the packet is not delivered, the caller will get an error so the caller can know. Since websocket is built on top of TCP, it has the same issue.
WSS is secure, so it prevents things like man-in-the-middle attacks. A secure transport prevents many attacks from the start. In conclusion, WebSockets aren't your standard socket implementation. WebSockets are versatile, the established connection is always open, and messages can be sent and received continuously.
I've been using WebSockets extensively in with high traffic applications and in situations where a single lost message (in either direction) is fatal. I've never seen any messages lost, ever. However, I do recall seeing a post or question somewhere about the same issue and that person was also using superWebSocket for the server. So my strong suspicion is that there is a bug in superWebSocket.
Do you see the same problem if you use a non-mobile browser? It's possible the iOS brower (I assume that's what you mean by mobile Safari) has a WebSocket bug. I've not extensively tested that browser with WebSockets. I have extensively tested Chrome, Firefox (with WebSocket enabled), and Opera (with WebSocket enabled) on Linux and Windows and Safari on Windows.
There is no occasion where a send in Javascript is allowed to not reach the server except if the whole connection fails. If that is happening then there is a bug somewhere.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With