# SocketIO with mongoDB

**URL:** https://discourse.nodered.org/t/socketio-with-mongodb/44965
**Category:** General
**Created:** [30 April 2021 07:15 UTC](https://discourse.nodered.org/t/socketio-with-mongodb/44965 "2021-04-30T07:15:44Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![yaminabes](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yaminabes/32/40221_2.png) [@yaminabes](https://discourse.nodered.org/u/yaminabes)
#### Post date: [30 April 2021 07:15 UTC](https://discourse.nodered.org/t/socketio-with-mongodb/44965/1 "2021-04-30T07:15:44Z")

</div>

Hi every one !  
I am trying to acces data sent over socketIO from a database mongo2 node. The idea is to retrive the msg.payload after de mongo2 node and send it in a socketIO node. I tried to add a socketOut just after the mongo2 node and I added a socketIn with a full msg debug to see what happens but nothing happens. So I tried to just send data like the flow below but I see that I did not understand how does socketIO work without template...  
Am I using the right node? Any suggestion will help 😅

```auto
[{"id":"b79c7d76.564898","type":"socketio-in","z":"2d750ed.93b04f2","name":"","server":"a402a54e.b77628","rules":[],"x":380,"y":620,"wires":[["cd6dde02.21d698"]]},{"id":"37f672f7.fb2236","type":"socketio-out","z":"2d750ed.93b04f2","name":"","server":"a402a54e.b77628","x":840,"y":420,"wires":[]},{"id":"cd6dde02.21d698","type":"debug","z":"2d750ed.93b04f2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":730,"y":620,"wires":[]},{"id":"33fe7877.886a8","type":"inject","z":"2d750ed.93b04f2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":270,"y":420,"wires":[["5d908e43.e62db8"]]},{"id":"5d908e43.e62db8","type":"change","z":"2d750ed.93b04f2","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"test\":\"test\"}","tot":"json"},{"t":"set","p":"socketIOEmit","pt":"msg","to":"test","tot":"str"},{"t":"set","p":"socketIOEvent","pt":"msg","to":"broadcast","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":420,"wires":[["37f672f7.fb2236"]]},{"id":"a402a54e.b77628","type":"socketio-config","port":"80","sendClient":"true","path":"/socket.io","bindToNode":true}]

```

---

<div class="post-metadata">

### Author: ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)
#### Post date: [30 April 2021 13:40 UTC](https://discourse.nodered.org/t/socketio-with-mongodb/44965/2 "2021-04-30T13:40:02Z")

</div>

Hi ..  
you dont need third party nodes to create a websocket connection as these are part of the Node-red core nodes.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/3/e3a755616cf099e5e777bf6c62a7bfd3ff908801.png)

An example of their use can be found [here](https://flows.nodered.org/flow/8666510f94ad422e4765)

If your end goal is to create a Webpage / Dashboard to show this data coming from your mongodb, then you can use the [Node-Red Dashboard](https://flows.nodered.org/node/node-red-dashboard) set of nodes or [Uibuilder](https://flows.nodered.org/node/node-red-contrib-uibuilder)

---

<div class="post-metadata">

### Author: ![yaminabes](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yaminabes/32/40221_2.png) [@yaminabes](https://discourse.nodered.org/u/yaminabes)
#### Post date: [5 May 2021 09:48 UTC](https://discourse.nodered.org/t/socketio-with-mongodb/44965/3 "2021-05-05T09:48:59Z")

</div>

Thanks for your answer, I ended up using those nodes 😁

---

<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: [4 July 2021 09:49 UTC](https://discourse.nodered.org/t/socketio-with-mongodb/44965/4 "2021-07-04T09:49:10Z")

</div>

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