Before I dive into the code, can someone tell me if there is any documentation available for confirmed delivery in Socket.IO?
Here's what I've been able to glean so far:
This leaves me with some questions:
I'm at a bit of a loss as to how Socket.IO can be used in a time sensitive application without falling back to volatile mode and using an external ACK layer that can provide failure events and some level of configurability. Or am I missing something?
The delivery confirmation you seek is related to the Two Generals Problem, which is also discussed in this SO answer.
TCP manages the reliability problem by guaranteeing delivery after infinite retries. We live in a finite universe, so the word "guarantee" is theoretically dubious :-)
Engine.io, the underpinnings of socket.io 1.x, uses the following transports:
Each of those transports is based upon TCP, so each individual socket.io message or event should be reliable. However, two things can happen on the fly:
So what happens when a client or your server squirts off a few messages while the hoses and pumps are being fiddled with like that? It doesn't say in either protocol (currently at versions 3 and 4, respectively, as of this writing). But, as you suggest in your comments, there is some acknowledgement logic in the implementation.
You're welcome to adopt my policies:
Guaranteed message delivery acknowledgement is proven impossible, but TCP manages to guarantee delivery and order really well anyways. I'm less confident about socket.io events, but they're really powerful so I just use them with care.