# Multiple topics in web socket

**URL:** https://discourse.nodered.org/t/multiple-topics-in-web-socket/34419
**Category:** Developing Nodes
**Created:** [17 October 2020 16:00 UTC](https://discourse.nodered.org/t/multiple-topics-in-web-socket/34419 "2020-10-17T16:00:44Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![tikky](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tikky/32/30508_2.png) [@tikky](https://discourse.nodered.org/u/tikky)
#### Post date: [17 October 2020 16:00 UTC](https://discourse.nodered.org/t/multiple-topics-in-web-socket/34419/1 "2020-10-17T16:00:44Z")

</div>

Hello,

I have about a hundred of GPS trackers. I would like to create a separate web socket topic for every single gps tracker, and then update web page (with latest lat/lon position) via web sockets in "near real live".

At the moment I know how to do that by hand - creating one or few web-sockets topics.  
But I haven't find a way how to do that by script or dynamically? Is that possible.  
For security reason I do not want to create a json with all trackers.

I will appreciate any help.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [17 October 2020 16:08 UTC](https://discourse.nodered.org/t/multiple-topics-in-web-socket/34419/2 "2020-10-17T16:08:02Z")

</div>

The core websocket nodes use a URL rather than a topic. You could include a topic in the payload and then move things around using a change node.

Alternatively, you could use uibuilder to build your web pages. It provides you with a websocket interface that looks exactly like the message passing you get in Node-RED so you can use whatever you like including msg.topic, msg.payload, etc.

The uibuilderfe library is the front-end library that you put into your web page and provides the communications magic.

---

<div class="post-metadata">

### Author: ![tikky](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tikky/32/30508_2.png) [@tikky](https://discourse.nodered.org/u/tikky)
#### Post date: [17 October 2020 16:15 UTC](https://discourse.nodered.org/t/multiple-topics-in-web-socket/34419/3 "2020-10-17T16:15:11Z")

</div>

yes, sorry I've asked about topics, but I mean **url**

So is it possible in Node-Red to create hundreds of web socket with specific url for (in my case) specific tracker without doing it one-by-one manually?

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [17 October 2020 16:22 UTC](https://discourse.nodered.org/t/multiple-topics-in-web-socket/34419/4 "2020-10-17T16:22:57Z")

</div>

No.

I believe that the websocket node will create the url when Node-RED starts (or the node is deployed) so it isn't dynamic.

The uibuilder websocket connection is much the same. It builds a connection for each instance of uibuilder that you deploy. However, as I say, uibuilder hides all of the implementation details from you and you can use the socket connection to pass messages just as they are in Node-RED itself.

So, in your case, you have incoming data from your GPS devices to Node-RED, presumably you use a flow to make the topic for the incoming data match the specific device. Using uibuilder, you can simply pass that msg to your front-end and process it there however you like.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [16 December 2020 16:23 UTC](https://discourse.nodered.org/t/multiple-topics-in-web-socket/34419/5 "2020-12-16T16:23:00Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
