Skip to content

Maximum Number of Namespaces/Rooms #4754

Answered by darrachequesne
vsaw asked this question in Q&A
Discussion options

You must be logged in to vote

Hi!

Is that a sensible use of Namespaces or would Rooms be better suited for this?

Without knowing all details of your application, it's a bit hard to tell, but maybe one namespace for telemetry and one for commands would suit your need:

io.of("/telemetry").on("connection", (socket) => {
  socket.join(<device-uuid>);

  io.to(<device-uuid>).emit(...);

  socket.on(...);
});

io.of("/commands").on("connection", (socket) => {
  socket.join(<device-uuid>);

  io.to(<device-uuid>).emit(...);

  socket.on(...);
});

This way, the telemetry events are cleanly split from the commands events.

Are there any hard/soft limits on the number of Namespaces or Rooms Socket.IO can sensibly handle?

No,…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by vsaw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants