dotproduct
dotproduct copied to clipboard
[Suggestion] Use multiplexing on WebSockets
Posting on behalf of JoWie @ http://www.subspace.co/topic/26499-dotproduct/#entry283045
Have you tried using inverse multiplexing for the WebSocket network communication?. Could help with incidental packetloss.
The big issue with TCP is the buffering after packetloss/bit error/etc occurs (one segment gets dropped/damaged, subsequent segments are delayed until the bad segment is resolved). Those may have been the big latency spikes in the video.
If you implement a system where you:
- use multiple WebSockets
- track the arrival of the messages you send (other party replies with an acknowledgment message)
- when sending, use the socket with the least in-flight/unacknowledged messages.
This works especially well for redundant data (like the position of a player). I tested this a while back, and as long as you have enough sockets and the cause of packetloss is incidental (like bit error) and not caused by congestion, the latency is comparable to UDP.
Of course this assumes your engine is able to deal with messages arriving in the wrong order.
Oh, and this piece of javascript code may be interesting (works for me with firefox + java): http://pastebin.com/6tYG8rqK . Uses LiveConnect to open an UDP connection without user interaction. Downside is that it does not work on localhost, only works with domains if you set up a reverse dns.