V
V
Vayladion Gognazdiak2018-10-14 08:04:50
Ruby on Rails
Vayladion Gognazdiak, 2018-10-14 08:04:50

How to make ActionCable use its own namespace in Redis?

Morning in the house, dear!
ENV: ruby ​​2.4.1, rails 5.1, nginx 1.10.3
There is a server running 3 identical services. Each of the services uses WebSockets.
All channel settings are the same. The difference is only in the cable.yml config
For the first service:

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

For the other two
urls: redis://localhost:6379/2 and url: redis://localhost:6379/3 respectively.
Channel:
class MessagesChannel < ApplicationCable::Channel  
  def subscribed
    stream_from 'messages'
  end
end

When sending a message to a channel by one of the services, it arrives to the subscribers of others.
Shipping:
ActionCable.server.broadcast('messages', message.to_json)

How to overcome this misunderstanding? Where to dig?
PS: I tried to spread through different channels - the same eggs only in profile.
UPD:
I made it with the gem 'action_cable_subscription_adapter', but I would like to use regular tools, of course.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question