You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 11, 2020. It is now read-only.
I'm currently testing Mosca and having a problem getting it to play nice with MongoDB.
On publishing to a subscribed client, the broker fails with the following error:
/usr/local/bin/node Server/app.js
Server ready
/home/leo/test/Server/node_modules/mosca/node_modules/mqtt/lib/generate.js:178
length += Buffer.byteLength(payload);
^
Published { cmd: 'publish',
retain: false,
qos: 0,
dup: false,
length: 28,
topic: 'heartbeat',
payload: <Buffer 74 69 6d 65 31 33 38 33 32 31 37 33 38 32 39 33 32> }
TypeError: Argument must be a string
at Object.module.exports.publish (/home/leo/test/Server/node_modules/mosca/node_modules/mqtt/lib/generate.js:178:22)
at MqttServerClient.eval [as publish] (eval at <anonymous> (/home/leo/test/Server/node_modules/mosca/node_modules/mqtt/lib/connection.js:58:29), <anonymous>:2:26)
at Client.actualSend (/home/leo/test/Server/node_modules/mosca/lib/client.js:142:21)
at Client.forward (/home/leo/test/Server/node_modules/mosca/lib/client.js:198:10)
at Array.handler [as 0] (/home/leo/test/Server/node_modules/mosca/lib/client.js:347:10)
at EventEmitter.TrieAscoltatore.publish (/home/leo/test/Server/node_modules/mosca/node_modules/ascoltatori/lib/trie_ascoltatore.js:52:11)
at EventEmitter.newPublish (/home/leo/test/Server/node_modules/mosca/node_modules/ascoltatori/lib/abstract_ascoltatore.js:122:20)
at /home/leo/test/Server/node_modules/mosca/node_modules/ascoltatori/lib/mongo_ascoltatore.js:202:29
at process._tickCallback (node.js:415:13)
Process finished with exit code 8
Any pointers on where I might be going astray? To confirm, this error only occurs when configuring a MongoDB backend. I'm testing with Node v0.10.21 in both Windows x64 and Ubuntu - results are consistent.
Below are my server/client.js I am using for testing.
varmqtt=require('mqtt');varclient=mqtt.createClient(1883,'localhost');varhandleConnect=function(){console.log('Connected to mqtt broker with ClientId:',client.options.clientId);client.on('message',handleMessage);client.subscribe('heartbeat');client.publish('heartbeat','time'+newDate().getTime());}varhandleMessage=function(topic,message,packet){console.log('Received Message');console.log('topic:',topic,'message',message);}client.on('connect',handleConnect);
The text was updated successfully, but these errors were encountered:
Hi,
I'm currently testing Mosca and having a problem getting it to play nice with MongoDB.
On publishing to a subscribed client, the broker fails with the following error:
Any pointers on where I might be going astray? To confirm, this error only occurs when configuring a MongoDB backend. I'm testing with Node v0.10.21 in both Windows x64 and Ubuntu - results are consistent.
Below are my server/client.js I am using for testing.
server.js:
client.js:
The text was updated successfully, but these errors were encountered: