【发布时间】:2014-02-03 01:40:34
【问题描述】:
所以我在我的应用程序中使用 Pusher Heroku 插件。该应用程序具有实时通知,因此当用户收到一条消息时,他会看到一个弹出通知,上面写着“新消息”。但是,在生产中我收到以下错误:
Firefox can't establish a connection to the server at ws://ws.pusherapp.com/app/b1cc5d4f400faddcb40b?protocol=7&client=js&version=2.1.6&flash=false.
Reload the page to get source for: http://js.pusher.com/2.1/pusher.min.js
这是 Pusher 控制器:
class PusherController < ApplicationController
protect_from_forgery :except => :auth # stop rails CSRF protection for this action
def auth
Pusher.app_id = ENV['PUSHER_APP_ID']
Pusher.key = ENV['PUSHER_KEY']
Pusher.secret = ENV['PUSHER_SECRET']
if current_user && params[:channel_name] == "private-user-#{current_user.id}"
response = Pusher[params[:channel_name]].authenticate(params[:socket_id])
render :json => response
else
render :text => "Not authorized", :status => '403'
end
end
end
我正在使用figaro gem 将密钥推送到heroku。
我做错了什么?
亲切的问候
【问题讨论】:
标签: ruby-on-rails heroku ruby-on-rails-4 pusher