Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redis adapter ^6.1.1 #492

Closed
domg92 opened this issue Mar 24, 2023 · 2 comments
Closed

Redis adapter ^6.1.1 #492

domg92 opened this issue Mar 24, 2023 · 2 comments
Labels
question Further information is requested
Milestone

Comments

@domg92
Copy link

domg92 commented Mar 24, 2023

Hi There! Recently I'm playing around with upgrading redis adapter and socket IO version an I'm trying to understand one change.
In newer versions we're subscribing to all rooms:

this.subClient.psubscribe(this.channel + "*", onError);

For projects handling hundreds thousands of WS connections with multiple machines and node processes this solution is a little bit inefficient. So I decided to rewrite adapter as it worked a couple of versions before, to subscribe and unsubscribe to rooms that I want to. But maybe somehow I'm using socket.io in wrong way. Can you please explain that change? Below in the URL there is my implementation for adapter to subscribe and unsubscribe for rooms that I need at the moment.
Thanks in advance.

https://pastebin.com/8Gr5hKWw

@darrachequesne
Copy link
Member

Hi! Actually it was implemented like that in previous releases, please see the rationale here: #102

@darrachequesne darrachequesne added the question Further information is requested label Mar 27, 2023
darrachequesne added a commit that referenced this issue May 2, 2023
The subscriptionMode option allows to configure how many Redis Pub/Sub
channels are used:

- "static": 2 channels per namespace

Useful when used with dynamic namespaces.

- "dynamic": (2 + 1 per public room) channels per namespace

The default value, useful when some rooms have a low number of clients
(so only a few Socket.IO servers are notified).

Related:

- #491
- #492
- #493
@darrachequesne
Copy link
Member

darrachequesne commented May 2, 2023

The subscriptionMode option of the sharded adapter now allows to control the behavior of the adapter regarding subscription.

See: d3388bf

Thanks!

@darrachequesne darrachequesne added this to the 8.2.0 milestone May 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants