fix code in sc-mqtt module

This commit is contained in:
walterhiggins 2014-02-04 21:04:12 +00:00
parent 349c2f17cf
commit fe62f61883
2 changed files with 26 additions and 48 deletions

View file

@ -869,30 +869,19 @@ present in the CraftBukkit classpath. To use this module, you should
messages to/from a Net-enabled Arduino or any other device which uses messages to/from a Net-enabled Arduino or any other device which uses
the [MQTT protocol][mqtt] the [MQTT protocol][mqtt]
var mqtt = require('sc-mqtt');
var mqtt = require('sc-mqtt'); // create a new client
var client = mqtt.client( 'tcp://localhost:1883', 'uniqueClientId' );
// create a new client // connect to the broker
client.connect( { keepAliveInterval: 15 } );
var client = mqtt.client( 'tcp://localhost:1883', 'uniqueClientId' ); // publish a message to the broker
client.publish( 'minecraft', 'loaded' );
// connect to the broker // subscribe to messages on 'arduino' topic
client.subscribe( 'arduino' );
client.connect( { keepAliveInterval: 15 } ); // do something when an incoming message arrives...
client.onMessageArrived( function( topic, message ) {
// publish a message to the broker console.log( 'Message arrived: topic=' + topic + ', message=' + message );
});
client.publish( 'minecraft', 'loaded' );
// subscribe to messages on 'arduino' topic
client.subscribe( 'arduino' );
// do something when an incoming message arrives...
client.onMessageArrived( function( topic, message ) {
console.log( 'Message arrived: topic=' + topic + ', message=' + message );
});
The `sc-mqtt` module provides a very simple minimal wrapper around the The `sc-mqtt` module provides a very simple minimal wrapper around the
[Eclipse Paho MQTT Version 3 Client][pahodocs] java-based MQTT [Eclipse Paho MQTT Version 3 Client][pahodocs] java-based MQTT

View file

@ -29,30 +29,19 @@ present in the CraftBukkit classpath. To use this module, you should
messages to/from a Net-enabled Arduino or any other device which uses messages to/from a Net-enabled Arduino or any other device which uses
the [MQTT protocol][mqtt] the [MQTT protocol][mqtt]
var mqtt = require('sc-mqtt');
var mqtt = require('sc-mqtt'); // create a new client
var client = mqtt.client( 'tcp://localhost:1883', 'uniqueClientId' );
// create a new client // connect to the broker
client.connect( { keepAliveInterval: 15 } );
var client = mqtt.client( 'tcp://localhost:1883', 'uniqueClientId' ); // publish a message to the broker
client.publish( 'minecraft', 'loaded' );
// connect to the broker // subscribe to messages on 'arduino' topic
client.subscribe( 'arduino' );
client.connect( { keepAliveInterval: 15 } ); // do something when an incoming message arrives...
client.onMessageArrived( function( topic, message ) {
// publish a message to the broker console.log( 'Message arrived: topic=' + topic + ', message=' + message );
});
client.publish( 'minecraft', 'loaded' );
// subscribe to messages on 'arduino' topic
client.subscribe( 'arduino' );
// do something when an incoming message arrives...
client.onMessageArrived( function( topic, message ) {
console.log( 'Message arrived: topic=' + topic + ', message=' + message );
});
The `sc-mqtt` module provides a very simple minimal wrapper around the The `sc-mqtt` module provides a very simple minimal wrapper around the
[Eclipse Paho MQTT Version 3 Client][pahodocs] java-based MQTT [Eclipse Paho MQTT Version 3 Client][pahodocs] java-based MQTT