S
S
svirepui2017-07-25 11:21:21
Node.js
svirepui, 2017-07-25 11:21:21

What is the principle of implementing "rooms" in node.js?

I want to implement this:
1. The user creates a room. A link to this room is automatically generated, for example, 127.0.0.1:3000/room/jdhjfheou439u94uil
2. Using the link, other users can join this room.
The problem is that I have one socket connection, regardless of the number of rooms, and I would like each room to have its own socket connection.
How to implement it?
Tried like this

app.get("/room/:hash", function(req, res) {
  io.on("connection", function(socket) {});
});

But it doesn't work.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
emp1re, 2017-07-25
@emp1re

--->

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question