NodeJS

Description

This is the JavaScript library for the browser, built and maintained by emitter.io team. The underlying communication layer uses MQTT.js and released under MIT license. More detailed documentation can be found in the GitHub repository: https://github.com/emitter-io/javascript.

NPM

Installation

Emitter for NodeJS:

npm install emitter-io --save

Usage Example

var client = require('emitter-io').connect(); 

// once we're connected, subscribe to the 'chat' channel
client.subscribe({
	key: "<channel key>",
	channel: "chat"
});
    
// on every message, print it out
client.on('message', function(msg){
	console.log( msg.asString() );
});

// publish a message to the chat channel
client.publish({
	key: "<channel key>",
	channel: "chat/my_name",
	message: "hello, emitter!"
});