scanno / nl.scanno.mqtt

13 stars 8 forks source link

Added public send message api #10

Closed harriedegroot closed 5 years ago

harriedegroot commented 5 years ago

Be able to send messages using the api from HomeyScript or other apps. E.g. used by MQTT Dispatcher.

Made the following changes to the broker:

scanno commented 5 years ago

Could you create the pull request based on the beta branch? Interesting since i was playing with a app2app possibilty.

scanno commented 5 years ago

20190106-14:34:02 successfully subscribed to topic hallo/test/# /broker.js:189 let callbacks = this.loadingTopics.get(topicName); ^

TypeError: Cannot read property 'get' of undefined at connectedClient.subscribe (/broker.js:189:55) at outgoing.(anonymous function) (/node_modules/mqtt/node_modules/mqtt/lib/client.js:549:5) at MqttClient._handleAck (/node_modules/mqtt/node_modules/mqtt/lib/client.js:1058:7) at MqttClient._handlePacket (/node_modules/mqtt/node_modules/mqtt/lib/client.js:343:12) at work (/node_modules/mqtt/node_modules/mqtt/lib/client.js:292:12) at Writable.writable._write (/node_modules/mqtt/node_modules/mqtt/lib/client.js:302:5) at doWrite (/node_modules/mqtt/node_modules/readable-stream/lib/_stream_writable.js:428:64) at writeOrBuffer (/node_modules/mqtt/node_modules/readable-stream/lib/_stream_writable.js:417:5) at Writable.write (/node_modules/mqtt/node_modules/readable-stream/lib/_stream_writable.js:334:11) at TLSSocket.ondata (_stream_readable.js:639:20)

scanno commented 5 years ago

Why would you want to subscribe to a topic when you publish a message? There is no need to do so, unless you have a specific reason for that.

scanno commented 5 years ago

merged into the message_api branch.