Ruby on rails Heroku上的ActionCable客户端未接收数据
我的rails(5.0.0beta4)(和actioncable)在本地运行良好 但在heroku上,浏览器似乎没有从actioncable流接收任何数据 以下是我的heroku设置: 我正在使用redis去插件Ruby on rails Heroku上的ActionCable客户端未接收数据,ruby-on-rails,ruby,heroku,ruby-on-rails-5,actioncable,Ruby On Rails,Ruby,Heroku,Ruby On Rails 5,Actioncable,我的rails(5.0.0beta4)(和actioncable)在本地运行良好 但在heroku上,浏览器似乎没有从actioncable流接收任何数据 以下是我的heroku设置: 我正在使用redis去插件 production: &production adapter: redis url: redis://redistogo:[password]@hoki.redistogo.com:9079/ host: hoki.redistogo.com port: 90
production: &production
adapter: redis
url: redis://redistogo:[password]@hoki.redistogo.com:9079/
host: hoki.redistogo.com
port: 9079
password: [password]
inline: true
timeout: 10
在config/environments/production.rb中
config.action_cable.url = "https://duewiz.herokuapp.com/cable"
config.action_cable.allowed_request_origins = ["https://duewiz.herokuapp.com",/http:\/\/duewiz.herokuapp.com.*/]
在这里,我尝试了wss和https协议,但两者都不起作用
在routes.rb中
mount ActionCable.server=>“/cable”
在app/assets/javascripts/channels/cable.coffee.erb
#= require action_cable
#= require_self
#= require_tree .
#
@App ||= {}
App.cable = ActionCable.createConsumer()
我已经在redis to go服务器上运行了redis cli monitor
,它从我的ActionCable.broadcast
调用中打印出数据
在heroku日志中,我可以看到ActionCable
广播
但我看不到我的浏览器有任何变化,但在本地一切正常
我已经为每个部署运行了heroku restart
我还记得一件事,我使用Desive/warden进行auth(也用于actioncable)
模块应用程序表
类连接
那么,我应该如何配置actioncable以便在heroku上部署
谢谢你的帮助
谢谢你。我的浏览器控制台中没有javascript错误。您的javascript控制台中有错误吗?谢谢提醒我。但在浏览器的开发工具控制台中并没有javascript错误。您找到解决方案了吗?
module ApplicationCable
class Connection < ActionCable::Connection::Base
identified_by :current_user
def connect
self.current_user = find_verified_user
logger.add_tags 'ActionCable', current_user.email
end
protected
def find_verified_user
if verified_user = User.find_by(id: cookies.signed['user.id'])
verified_user
else
reject_unauthorized_connection
end
end
end
end