This is a simple mqtt client on node.js
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
MQTTClient.js fix a publish bug Feb 14, 2011
README No commit message Feb 10, 2011


This is a simple MQTT client on node.js

The lib is still under developing.

Author: FAN Yilun @ CEIT


Event: ‘sessionOpened’
Fired when a session with broker is opened sucesffully.

Event: ‘mqttData’
Fired when data is available for client, topic and payload have been extracted from data.
client.addListener(‘mqttData’, function(topic, payload){


Event: ‘openSessionFailed’
Fired when a session can not be established.

Event: ‘connectTimeOut’
Fired when cant establish a connection with server.

MQTTClient(port, host, clientID);
Construct a instance of mqtt client.
@port: port number, like 1883.
@host: server ip address.
@clientID: client name for server.

Subscribe to a topic.
@sub_topic: topic to be subscribed.

publish(pub_topic, msg);
Publish messages to a topic.
@pub_topic: publish topics.
@msg: payload data, can be anything, string, bytes.

Disconnect with server.