adamvr/MQTT.js — pull request #114 by samirnaik (2013-07-02 20:38:49+00:00)
Title: Fixes and test cases for secureClient

Hi @adamvr,

I wanted to use this library w/ the TLS support, but noticed there were a few things not working. This should be able to close issue #28

Main changes:

- lib/client.js - Added a listener for stream.on('secureConnect') that does the same thing as the stream.on('connect') listener

- lib/client.js - Refactored setup of connection and event listeners to a method "setStream" so this could be called on reconnect. Slightly weird, but the cleartextStream's API is different than the net connection, and has no "connect" method, so needed to find a way to replace the stream/connection of an existing MqttClient.

- test/helpers - old cert/key were expired, so added some new ones

- examples - Added secure-server and secure-client in the examples.

- README - documentation was incorrect for the subscribe event handler on the example server

Let me know if I need to fix anything up.

Thanks,
Samir