Using a middleware could previously lead to a connecting client
receiving a connect event from the server before the server triggers
its own connect event.
* fix(socket): Fixes socket.use error packet which drops nodejs due to nuances of Nodejs' EventEmitter
* fix(socket): Fixes missing error event on socket
* fix(socket): test fix, should listen for clientSocket instead of server socket
* minor update
We declare `sent = false` and even check `if (sent)` is truthy, but we never set it to truthy, therefore it never really *prevents double callbacks*...
lib/namespace.js previously was not considering whether an event had
binary data and was giving all events parser.EVENT type -- now it uses
the has-binary-data module to set the event type appropriately.
Then, after this fix there was a problem with lib/adapter.js -- because
socket.io-parser modifies the packet object in its encoding, the sockets
after the 1st in a broadcast were not getting the correct data. To fix
this, the data is encoded once in adapter, and then the encoded data
is passed to each of the sockets.
lib/socket.js and lib/client.js were updated to allow for the above. The
.packet method of each now takes an optional second "preEncoded" parameter
-- if this is true, then client skips the encoding and just writes the
packet argument directly to engine.
test/socket.io.js was updated to add two new tests that test
multi-messaging of events with binary data.
This is a squash of about 25 commits, and here is a summary:
adamreis added initial binary test with the doge image.
kevin-roark updated binary tests and wrote some binary encoding protocol.
kevin-roark replaced the custom binary encoding with msgpack because we
have to handle arbitrary json that contains binary.
adamreis added some 'crazy' tests for emmiting and receiving events with
several types of data.
kevin-roark updated client.js to use socket.io-protocol's async encoding
Did a bunch of upstream merging.