How to use the createClient function from mqtt
Find comprehensive JavaScript mqtt.createClient code examples handpicked from public code repositorys.
49 50 51 52 53 54 55 56 57 58
console.log("Connecting securely to MQTT broker at " + serviceSpec.properties.secureaddress + ":" + serviceSpec.properties.secureport); this.client = mqtt.createSecureClient(serviceSpec.properties.secureport, serviceSpec.properties.secureaddress, opts); } else { this.client = mqtt.createClient(serviceSpec.port, serviceSpec.address); } this.spec = serviceSpec; this.client.subscribe(this.spec.name);
10
0
13
GitHub: yunba/MQTT.js
32 33 34 35 36 37 38 39 40
For the sake of simplicity, let's put the subscriber and the publisher in the same file: ```js var mqtt = require('mqtt') client = mqtt.createClient(1883, 'localhost'); client.subscribe('presence'); client.publish('presence', 'Hello mqtt');
0
7
11
+ 7 other calls in file
GitHub: feccruz/docs
187 188 189 190 191 192 193 194 195 196
username:'thermostat-1a', password:'the password' } // client connection var client = mqtt.createClient(port, host, settings); setInterval(sendTemperature, 2000, client); function sendTemperature(client){
0
1
1
+ 3 other calls in file
mqtt.connect is the most popular function in mqtt (440 examples)