Is Action Cable 5 Redis required?

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 got my demo chat to work in development mode without Redis . I installed the config/cable.yml

as follows:

development:
  adapter: async

test:
  adapter: async

production:
  adapter: async 

      

and run rails c

. That it is - the chat works, no problem. So Redis is obviously no longer needed - unlike years ago?

Also I found a way to get my demo chat to work with Redis . For this, I change the config/cable.yml

as follows:

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:

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

    ? What is this for?

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

+3


source to share


2 answers


Is Action Cable 5 Redis required?

Not. According to the documentation , it may use other adapters.

The Action cable provides a subscription adapter interface to handle its pubsub. Default asynchronous, inline, PostgreSQL, Redis events, and non-event related Redis adapters. the default adapter in new Rails applications is an asynchronous (asynchronous) adapter.

Questions:

Is ActionC 5 required for Redis to work? (doesn't look right, but I'm not sure).



Not.

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

There is no difference in the case of ActionCable, it uses abstraction adapter

and is transport independent.

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

? What is this for?

It is for redis and provides an interface to communicate with the redis server.

+3


source


You can use an async adapter in dev, but the docs indicate that

The asynchronous adapter is for development / testing purposes and should not be used in production.

http://edgeguides.rubyonrails.org/action_cable_overview.html#configuration



I tried it anyway - and at least with my setup (nginx, passenger) - the async adapter just didn't work. I am guessing thread / process problems

For production, this gives you the option of Redis or PostgreSql

0


source







All Articles