adamvr/MQTT.js — pull request #124 by mcollina (2013-08-13 01:57:49+00:00)
Title: Connection as a Writable stream

I moved the parsing logic directly inside the Connection object, which became a Writable.
It is not needed to be a Duplex, as it will do nothing in writing.

The interface remains the same, but it allows cool stuff like:
```
// stream is from somewhere, it might be a named pipe, a websocket, or whatever other transport

var mqtt = require("mqtt");
var conn = stream.pipe(new mqtt.Connection());

conn.publish("hello", "world");
```

Fixes #121

@adamvr and @timoxley please provide feedbacks :).

I'd like this to go into #118, as it simplifies the reconnecting logic.

I'd like to also expose this through the "main" `mqtt` object, so we can do "crazy" ideas like MQTT over Websocket (and any other kind of Stream).