Aman kanojiya
Aman kanojiya

Reputation: 1

How to get Socket Setup at specific URL with different roomId?

I am new to Sockets and trying to set up a Live Streaming website, and I need your help to set up the problems I am facing.
I want to create multiple rooms for live stream, and my initial endpoint is /api/livestream what I want is similar to google meet /api/livestream/roomid

// Routes
app.use("/api/messages", messageRoutes);
app.get("/api/liveStream", (req, res) => {
  var roomid = uuidV4();
  res.redirect("api/liveStream/" + roomid);
});

// Server listner
const liveStream_io = io.of("/api/liveStream/:id");
liveStream_io.on("connection", liveStream.listen);
server.listen(process.env.PORT, () =>
  console.log(`Server started on ${process.env.PORT}`)
);

As you can see in this code, I am redirecting the user to livestream. listen function created

now my fundamental confusion is how can I get the id and is this the right way to configure the stream

Upvotes: 0

Views: 75

Answers (0)

Related Questions