Create ::Client, extract common parts from Reader

Signed-off-by: Pedro Melo <melo@simplicidade.org>
Make ::Reader use the new ::Client base class

Signed-off-by: Pedro Melo <melo@simplicidade.org>
Tweak ::Connection handling of *_cb parameters, more consistent errors

Signed-off-by: Pedro Melo <melo@simplicidade.org>
Add support for disconnect_cb on ::Connection

Signed-off-by: Pedro Melo <melo@simplicidade.org>
Fix: Connection disconnect_cb/error_cb were being called in the wrong order

Signed-off-by: Pedro Melo <melo@simplicidade.org>
Tweak consumer to use the new disconnect_cb

Signed-off-by: Pedro Melo <melo@simplicidade.org>
Tidy

Signed-off-by: Pedro Melo <melo@simplicidade.org>
Added skel for our Writer class:

It connect and identifies just fine, but no API for publishing right now.

Signed-off-by: Pedro Melo <melo@simplicidade.org>
Update _process_success_frame:

If it looks like JSON, parse it as JSON. If not assume normal success
message and send it to cb inside a hash on the 'msg' key.

Signed-off-by: Pedro Melo <melo@simplicidade.org>
Add disconnect() to Connection, using the CLS protocol command

Signed-off-by: Pedro Melo <melo@simplicidade.org>
Add disconnect() to Client, closes all connected conns

Signed-off-by: Pedro Melo <melo@simplicidade.org>
Add private _random_connected_conn() to return one of the connect conns

Not really random at this moment...

Signed-off-by: Pedro Melo <melo@simplicidade.org>
Add publish() to Connection, mapped to PUB command

Signed-off-by: Pedro Melo <melo@simplicidade.org>
Add publish() to Write

Signed-off-by: Pedro Melo <melo@simplicidade.org>
Simple TCP publisher, reads STDIN, publishes one message per line

Signed-off-by: Pedro Melo <melo@simplicidade.org>