Replies: 4 comments 8 replies
-
yes you can, you should firstly create the websocket using A bit tricky but should work, streamBuilder also requires an mqttclient in first argument but it's only needed in case you have Your own streamBuilder so could so something like this: const wsSocket = null /// the socket instance
const myStreamBuilder = (client, opts) => {
wsSocket = wsSocket || browserStreamBuilder(client, opts)
return wsSocket
}
const client = new MqttClient(myStreamBuilder, opts) I didn't tested above code and also I'm not sure about any unexpected issues related to this |
Beta Was this translation helpful? Give feedback.
-
Darn it, your suspicion was correct, the broker (FlashMQ) does not like that idea. |
Beta Was this translation helpful? Give feedback.
-
Alright, the other guys confirmed what i suspected as well:
@robertsLando
|
Beta Was this translation helpful? Give feedback.
-
Some information for Option 1: (simplicity, but separate ws connection overhead) – modern browsers allow up to 256 Websocket connections, that’s plenty, I’d limit each dashboard to ~50 widgets/components per page, plenty of overhead left. Option 2 needs solid engineering but done properly could work really well too! Thank you for all the help @robertsLando! ✌🏼 happy coding! |
Beta Was this translation helpful? Give feedback.
-
Hey folks,
Been trying to figure this one out for a while:
Is it possible to reuse the websocket connection and attempt to connect using few different clientIds?
Scenario would be multiple widgets that each have a separate MQTTClient yet they all use the same WebSocket connection.
That would neatly scope the subscription event handlers and ability for two widgets (two clients) to subscribe/unsub to the same topic (if UI user wanted to) without affecting the other widget (client).
Not sure if this is even possible at all :)
Beta Was this translation helpful? Give feedback.
All reactions