Ah, problem seems to be solved. I found the place to insert a print statement by triggering a crash from within my .on('data', ..) handler and looking at the stack trace. I added a print statement to the first call that came after node's internal junk, which was in faye's websocket driver, and found that the network frame was reaching the physical interface but was not actually getting to faye. This meant that the bug was either in the OS or in node.
I tried upgrading node to v4 (I was at v.10) and the bug went away. So the solution was to upgrade node. Apparently there are bugs with old versions of node when running semi-heavy websockets traffic.
on('connection')
and conncetion.close
, but this seems fragile to me
data
event only happens afterwards. If I bind the data
event first, I will not know which client sent the message. What’s the logical way to approach this?