moscajs / mosca

MQTT broker as a module
mosca.io
3.2k stars 513 forks source link

client and server is restarting automatically. when is set topic like: "test/test/test" #788

Closed InSantoshMahto closed 5 years ago

InSantoshMahto commented 5 years ago

You should do:

server.publish({
  topic: 'hello/work/test',
  payload: new Buffer('world'),
  qos: 1 // this is important for offline messaging
}, null, function done() {})

Originally posted by @mcollina in https://github.com/mcollina/mosca/issues/241#issuecomment-93653341

InSantoshMahto commented 5 years ago

sorry due to this code issue is occurs. let authorizeSubscribe = function(client, topic, callback) { // console.log('authorizeSubscriber'); callback(null, client.user == topic.split("/")[1]); };