publish MQTT syntax #513
Replies: 2 comments 3 replies
-
I've got the same issue after 2 hours I managed to find why. The first time you subscribe is ignored for some reason. If you subscribe ws.subscribe("1") <--- this will be ignored for publish but ws.subscribe("2") <---- this will publish to all clients. This started to happen after I upgraded to node.js 16 and the latest 19.2 version. I don't know if it's an issue with the library or node.js |
Beta Was this translation helpful? Give feedback.
-
this works fine so you should post your code if you need help @ws295203 app=require('uWebSockets.js').App().ws('/',{
open:ws=>{ws.subscribe('1');app.publish('1','a')}
}).listen(80,s=>{}) new WebSocket('ws://localhost') the OP @Avatarchik does not understand the MQTT syntax and apparently is not able to run the code to try themselves, their 2nd example seems to be what they are trying to do but dont know if they tried it |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi! This example does not work for me, the server will not send to all subscribers
or do I need to do this?
Beta Was this translation helpful? Give feedback.
All reactions