Multiple Acknowledgements Behavior Inconsistent

133 views
Skip to first unread message

deakblue

unread,
Jan 21, 2012, 5:11:13 AM1/21/12
to Socket.IO
This is fundamentally a specification question as the js client and
node servers behave oppositely. This concerns what is the correct
response when more than one acknowledgement arrives for the same
message id.

Case Node Server to Javascript Client:
--------------------------------------------------------
* Node.js Server .emit()s event "A" (msg type: 5+)
* Javascript Browser Client has registered *2* different
acknowledgements for event "A"

Result: Node.js server will trigger the acknowledgement function
TWICE, once for each acknowledgement message on the same id.


Case Javascript Client to Node Server (exactly the same example from
above inverted):
--------------------------------------------------------
* Javascript Client .emit()s event "A" (msg type: 5+)
* Node.js Server has registered *2* different acknowledgements for
event "A"

Result: Javascript client will trigger the acknowledgement function
only ONCE. The js client reads the first acknowledgement and ignores
all future events on the same message id.



Reading the specification several times, my guess is only one
acknowledgement should be expected when emitting a 5+ event and the
Javascript client is correctly (or legitimately?) ignoring later
acknowledgments. If more than one acknowledgement is received for
the same message id, the behavior might be undefined (which is fine),
but the intent is to have only one acknowledging listener per event.

That said, the opposite is 'workable' if the idea is that perhaps a
bunch of event listeners could be waiting around a large system and
the emitter is expecting to hear acknowledgements from all of them.

Why this is important: I'm nearly done a socket.io client
implementation in Python for Kivy and I really need to nail down which
is the correct behavior.

Thanks and best regards,
-db-

Guillermo Rauch

unread,
Jan 21, 2012, 11:40:19 AM1/21/12
to sock...@googlegroups.com
An acknowledgement function can only be called once. 
--
Guillermo Rauch
LearnBoost CTO
http://devthought.com

deakblue

unread,
Jan 21, 2012, 4:39:49 PM1/21/12
to Socket.IO
"can only be called once" suggests node.js socket.io server has an
issue, because unlike Javascript, it will fire n-times for n responses
on the same message-id. It does not discard messages after the first
like client does.

Should I submit an issue?

Best regards,
-db-

Guillermo Rauch

unread,
Jan 21, 2012, 4:42:23 PM1/21/12
to sock...@googlegroups.com
No need, already addressed! Will hopefully push it out with the release tomorrow.
Thanks so much for the keen observation 

deakblue

unread,
Jan 21, 2012, 6:09:32 PM1/21/12
to Socket.IO
Socket.IO is awesome.

Now I can finish my python client.

Best regards,
-db-
Reply all
Reply to author
Forward
0 new messages