问题描述
我最近开始使用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 (将#修改为@)