mosca

Request response pattern with mosca MQTT

假如想象 提交于 2020-08-10 19:04:18
问题 Is there any way to implement request-response pattern with mosca MQTT to "check reply from the client and re publish if i dont receive expected reply within expected time". I believe this is possible in Mqtt 5, but as of now, I have to use Mosca broker with QoS 1(which support until Mqtt 3.1.1) I am looking for a Node js workaround to achieve this. 回答1: As per my comment you can implement a request-response pattern with any MQTT broker but, prior to v5, you need to implement this yourself

Request response pattern with mosca MQTT

做~自己de王妃 提交于 2020-08-10 19:03:04
问题 Is there any way to implement request-response pattern with mosca MQTT to "check reply from the client and re publish if i dont receive expected reply within expected time". I believe this is possible in Mqtt 5, but as of now, I have to use Mosca broker with QoS 1(which support until Mqtt 3.1.1) I am looking for a Node js workaround to achieve this. 回答1: As per my comment you can implement a request-response pattern with any MQTT broker but, prior to v5, you need to implement this yourself

mqtt client gets disconnected frequently when running on multiple threads

旧街凉风 提交于 2020-01-11 13:47:14
问题 I have mosca mqtt broker runnning. I connect to it using paho-mqtt from a python client. I have two threads which I run parallely in my code, one to receive messages and the other to publish. def SendCommand(rpm,valve_opening): control_packet = { ######## } print(control_packet) print('sending command') # client.publish("cmd",control_packet) def on_connect(client, userdata, flags, rc): if rc==0: print("connected OK Returned code=",rc) client.subscribe('data/#') else: print("Bad connection

Attempting MQTT connection…failed, rc=-2 try again in 5 seconds

自古美人都是妖i 提交于 2020-01-06 14:31:56
问题 I am trying to establish MQTT communication with my local MQTT server on my pc (node.js, express, Mosca) and Esp8266. esp8286 is not connecting with my server, the error is Attempting MQTT connection...failed, rc=-2 try again in 5 seconds Can't connect to Broker. Here is Node js code: var moscaSettings = { host: '0.0.0.0', port: 1883, http: { port: 8002, host: '0.0.0.0', static: './mqtt/', bundle: true, }, }; var server = new mosca.Server(moscaSettings); // var server = new mosca.Server({ //

Attempting MQTT connection…failed, rc=-2 try again in 5 seconds

核能气质少年 提交于 2020-01-06 14:29:08
问题 I am trying to establish MQTT communication with my local MQTT server on my pc (node.js, express, Mosca) and Esp8266. esp8286 is not connecting with my server, the error is Attempting MQTT connection...failed, rc=-2 try again in 5 seconds Can't connect to Broker. Here is Node js code: var moscaSettings = { host: '0.0.0.0', port: 1883, http: { port: 8002, host: '0.0.0.0', static: './mqtt/', bundle: true, }, }; var server = new mosca.Server(moscaSettings); // var server = new mosca.Server({ //

Security key and cert for mosca MQTT broker

夙愿已清 提交于 2019-12-14 02:05:09
问题 I am trying to set up Mosca MQTT broker which is based on node.js From the documentation below, https://github.com/mcollina/mosca/wiki/TLS-SSL-Configuration var mosca = require('mosca') var SECURE_KEY = __dirname + '/../../test/secure/tls-key.pem'; var SECURE_CERT = __dirname + '/../../test/secure/tls-cert.pem'; Where do I get tls-key.pem and tls-cert.pem ? 回答1: From the link https://github.com/mcollina/mosca/wiki/TLS-SSL-Configuration in your question, you are directed to another link https:

node.js mqtt client using TLS

青春壹個敷衍的年華 提交于 2019-11-28 08:40:36
问题 I am trying to implement a node.js mqtt client with TLS using the package below; https://www.npmjs.com/package/mqtt#client The code for running mqtt client without TLS is as follows; var mqtt = require('mqtt') var client = mqtt.connect('mqtt://test.mosquitto.org') client.on('connect', function () { client.subscribe('presence') client.publish('presence', 'Hello mqtt') }) client.on('message', function (topic, message) { // message is Buffer console.log(message.toString()) client.end() }) How