Ask A Question

Notifications

You’re not receiving notifications from this thread.

Does actioncable create 1 channel per user only?

Masud Hossain asked in Rails

Let's say you're planning on having real time Notifications and messaging.

Does that mean that for each User, there will be 1 actioncable channel (redis) open?

Or

Does that mean for each User, there will be 2 actioncable channels (redis) opened? One for messaging and one for the notfications.

Reply

There's only 1 websocket open and you can use as many channels as you want to separate messages out across that websocket. Check out the browser's websocket messages as they come across and you'll see how it groups them into the different channels. ActionCable just handles the filtering for you so you don't have to.

Reply

Thanks for the response, Chris. The only thing im worried about is having too much real time stuff using actioncable and slowing down my app because my redis server or heroku server cant handle the high memory usage .

Reply

Masud, I think you'll have to benchmark your app and monitor memory usage and things to find out what it's actually using and if it's going to surpass your limits. There's no real way to tell ahead of time, but you can also try deploying the change and making it easy to roll back in case you do surpass your limits.

If it does look like it's going to be way too much, you can always try using http://anycable.io/ which can handle 20,000 idle ActionCable connections within 1GB of memory.

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 86,946+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.