Socket Room creation/subscription logic #34

Closed
opened 2026-02-04 16:42:07 +03:00 by OVERLORD · 1 comment
Owner

Originally created by @niraj1234567890 on GitHub (Oct 17, 2020).

Guys, did anyone found where did the socket room creation logic is written inside the project. I found that mainly two socket rooms are being used in the sails backend(more precisely in the helpers). ex. board:boardId and user:userId. I just wanted to understand that let's say I want to create an another room and send some data to that particular room ex. project:projectId. How should I approach that.

PS: I am new to the working with the sockets but have basic understanding.

Originally created by @niraj1234567890 on GitHub (Oct 17, 2020). Guys, did anyone found where did the socket room creation logic is written inside the project. I found that mainly two socket rooms are being used in the sails backend(more precisely in the helpers). ex. `board:boardId` and `user:userId`. I just wanted to understand that let's say I want to create an another room and send some data to that particular room ex. `project:projectId`. How should I approach that. PS: I am new to the working with the sockets but have basic understanding.
OVERLORD added the question label 2026-02-04 16:42:07 +03:00
Author
Owner

@meltyshev commented on GitHub (Oct 20, 2020):

Hi! You just need to call sails.sockets.join somewhere in a controller (only works for socket connections). You can find an example here - server/api/controllers/boards/create.js. If you want to join all project rooms then you need to call sails.sockets.join for each project in the server/api/controllers/projects/index.js.

@meltyshev commented on GitHub (Oct 20, 2020): Hi! You just need to call [`sails.sockets.join`](https://sailsjs.com/documentation/reference/web-sockets/sails-sockets/join) somewhere in a controller (only works for socket connections). You can find an example here - [`server/api/controllers/boards/create.js`](/plankanban/planka/tree/master/server/api/controllers/boards/create.js). If you want to join all project rooms then you need to call [`sails.sockets.join`](https://sailsjs.com/documentation/reference/web-sockets/sails-sockets/join) for each project in the [`server/api/controllers/projects/index.js`](/plankanban/planka/tree/master/server/api/controllers/projects/index.js).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/planka#34