oortcloud/node-ddp-client — pull request #7 by sarfata (2013-02-15 21:13:49+00:00)
Title: Add callbacks when message received, error occurs or connection closed

I was not satisfied with the first solution and having multiple callbacks passed to connect() so I looked at `ws` and how they dealt with it. I have adopted the same pattern.

So I use `events.EventEmitter` and inherit from it. And then have different messages: `on('connected')`, `on('message')`, `on('close')` and `on('error')`. I believe this solution to be much better. I hope you will agree.

Cheers!