Ruby on Rails-ActionCable-:#<ActionCable :: SubscriptionAdapter :: Test的未定义方法`redis_connection_for_subscriptions'

问题描述

我最近开始使用ActionCable并设法使多个渠道正常工作,但是在测试这些渠道时,我遇到了问题。

示例频道-订阅方法

def subscribed
  ActionCable.server.pubsub.redis_connection_for_subscriptions.sadd "#{room.id}_users",current_user.id
  stream_for room
  broadcast_to room,{ message: "#{current_user.firstname} is here ...",status: 'joining',id: current_user.id }
end

在开发中使用通道时,会将用户添加到Redis集。但是,在测试频道时,我遇到以下问题:

错误

NoMethodError: undefined method 'redis_connection_for_subscriptions' for #<ActionCable::SubscriptionAdapter::Test

我做了一些挖掘,发现'redis_connection_for_subscriptions'方法在轨道上:https://github.com/rails/rails/blob/master/actioncable/lib/action_cable/subscription_adapter/redis.rb#L43

有没有人遇到这个问题并找到解决方法

在此先感谢您的帮助

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...