Skip to main content

Does actioncable create 1 channel per user only?

Rails • Asked by Masud Hossain

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.


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.


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 .


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.


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 24,647+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.