Replies: 1 comment
-
Any custom events (e.g. setRoom) need to be emitted by you to be triggered. In terms of adding users to a room as an example you can do so on the connection event with the following code {
// ..
events: [
{
name: "connection",
handler: ({ strapi }, socket) => {
console.log("--connect--");
const room = "some-room";
socket.join(room);
console.log(`${socket.id} has joined room ${room}`);
},
},
];
// ..
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have some categories of users, and i want to set them in specific rooms. Can't understand, how can i do this. I've tried something like in original socket.io, but failed:
events:[ { name: "connection", handler: ({ strapi }, socket) => { console.log('--connect--') }, }, { name: "setRoom", handler: ({ strapi }, socket) => { socket.join("Test room") }, }, ]
Beta Was this translation helpful? Give feedback.
All reactions