Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Action Cable 5 require Redis?

I use:

rails (5.0.2)
actioncable (5.0.2)
puma (3.8.2)

I have a Rails 5 Action Cable demo chat and a year ago it didn't work without Redis - and now it does! (after bundle update).

In other words, I succedeed to make my demo chat to work in development mode without Redis. I set the config/cable.yml like this:

development:
  adapter: async

test:
  adapter: async

production:
  adapter: async 

and start rails c. That's it - the chat is working, no problem. So Redis is obviously not needed anymore - unlike a year-ago times?

Also I found a way to make my demo chat to work with Redis. To do so I change the config/cable.yml like this:

redis: &redis
  adapter: redis
  url: redis://localhost:6379/1

production: *redis
development: *redis
test: *redis

than add gem 'redis', '~>3.2' to my Gemfile (+ bundle install), start Redis redis-server and then rails c.

So my questions are:

  1. Does Action Cable 5 require Redis to work? (looks like don't but I'm not sure).
  2. If (apparently) Action Cable 5 can work with or without Redis - what's the difference?
  3. What is gem 'redis', '~>3.2'? What is it for?

Generally I have no idea what is now the proper usage of Action Cable 5 in terms of Redis usage (non-usage?). Is there any difference for the development or production mode?

like image 702
prograils Avatar asked Apr 03 '17 09:04

prograils


People also ask

Does ActionCable use Redis?

ActionCable is backed by Redis Pub/Sub. Redis is one incredible piece of engineering which we use extensively in our Ably infrastructure.

Does Actionis need Redis?

Action Cable provides a subscription adapter interface to process its pubsub internals. By default, asynchronous, inline, PostgreSQL, and Redis adapters are included.

Which Redis adapters are included in action cable 5?

By default, asynchronous, inline, PostgreSQL, evented Redis, and non-evented Redis adapters are included. The default adapter in new Rails applications is the asynchronous (async) adapter. Questions: Does Action Cable 5 require Redis to work?

What is action cable in rails 5?

One of the most interesting features that will be released in Rails 5 is action cable. Action cable adds a very important capability to Rails as part of the framework which is WebSockets.

What types of adapters are included in action cable?

By default, asynchronous, inline, PostgreSQL, and Redis adapters are included. The default adapter in new Rails applications is the asynchronous ( async) adapter. The Ruby side of things is built on top of websocket-driver , nio4r, and concurrent-ruby. Action Cable is powered by a combination of WebSockets and threads.

How does action cable work with Ruby?

The Ruby side of things is built on top of websocket-driver , nio4r, and concurrent-ruby. Action Cable is powered by a combination of WebSockets and threads. Both the framework plumbing and user-specified channel work are handled internally by utilizing Ruby's native thread support.


1 Answers

Does Action Cable 5 require Redis?

No. According to the documentation, it's able to use other adapters.

Action Cable provides a subscription adapter interface to process its pubsub internals. By default, asynchronous, inline, PostgreSQL, evented Redis, and non-evented Redis adapters are included. The default adapter in new Rails applications is the asynchronous (async) adapter.

Questions:

Does Action Cable 5 require Redis to work? (looks like don't but I'm not sure).

No.

If (apparently) Action Cable 5 can work with or without Redis - what's the difference?

In case of ActionCable there in no differences, it uses an abstraction adapter and does not depend on transport protocol.

What is gem 'redis', '~>3.2'? What is it for?

It's for redis and provides an interface for communication with redis-server.

like image 166
Philidor Avatar answered Sep 23 '22 23:09

Philidor