Skip to content

feat(sharded): add an option for dynamic private channels#526

Merged
darrachequesne merged 1 commit intosocketio:mainfrom
MartinKolarik:dynamic-private-2
Mar 13, 2024
Merged

feat(sharded): add an option for dynamic private channels#526
darrachequesne merged 1 commit intosocketio:mainfrom
MartinKolarik:dynamic-private-2

Conversation

@MartinKolarik
Copy link
Contributor

As an alternative solution for #524, this:

  • adds a new option dynamicPrivateChannels, which allows creating separate channels even for private rooms; defaults to false so there's no change in default behavior,
  • includes the fix from fix(sharded): private room broadcast in dynamic mode #525 which is needed when the option is set to false

@darrachequesne
Copy link
Member

Actually, I'm not sure that this is a good idea, as it could indicate that calling io.to(specificSocketId).emit() is recommended.

@MartinKolarik thoughts?

@MartinKolarik
Copy link
Contributor Author

@darrachequesne I think it makes sense if it's documented in regards to socketInstance.emit() as that method is public and not discouraged, as I understand (unlike using the ID directly). Maybe with a note that it's useful in some scenarios where you have lots of 1:1 communication and understand what you're doing. In our specific case, this simple change resulted in 70% - 80% overall redis load reduction.

@darrachequesne darrachequesne merged commit 50220f4 into socketio:main Mar 13, 2024
@darrachequesne
Copy link
Member

Thanks 👍

@MartinKolarik MartinKolarik deleted the dynamic-private-2 branch March 13, 2024 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants