primus/primus — pull request #230 by lpinca (2014-04-19 09:38:37+00:00)
Title: Emit the `connection` event before the `data` event

When using `setImmediate`, there are cases where the `data` event on the spark is called before the `connection` event on the primus instance:

```js
primus.on('connection', function (spark) {
console.log(spark.id + ' connected');
spark.on('data', function (data) {
console.log(data);
});
});

for (var i = 0; i < 10; i++) {
(new primus.Socket(url)).write('hello ' + i);
}
```
This causes the loss of some messages because we add the a listener for `data` after the `connection`, so i think it's better to only use `process.nextTick`.

**The integration test included with the patch does not pass with the `browserchannel` transformer. All the connection are created but the message is received only for the first four. This needs investigation.**