Ruby on rails WebSocket握手期间出错:意外响应代码:503
我正在尝试将websocket rails与angular和heroku一起使用。它正在开发中,但现在正在生产中。下面是发布事件的服务器代码和侦听事件的客户端代码Ruby on rails WebSocket握手期间出错:意外响应代码:503,ruby-on-rails,heroku,websocket-rails,Ruby On Rails,Heroku,Websocket Rails,我正在尝试将websocket rails与angular和heroku一起使用。它正在开发中,但现在正在生产中。下面是发布事件的服务器代码和侦听事件的客户端代码 #Server WebsocketRails[channel_name].trigger('new_message', @json) //Client var dispatcher = new WebSocketRails(window.location.host + "/websocket"); var channel = dis
#Server
WebsocketRails[channel_name].trigger('new_message', @json)
//Client
var dispatcher = new WebSocketRails(window.location.host + "/websocket");
var channel = dispatcher.subscribe(channel_name);
channel.bind('new_message', function(data) {
$scope.$apply(function(){
cr.unread_messages += 1;
});
});
我在生产中使用SSL。我已经试过了
force_ssl = false
在production.rb
中,但无效
我得到的错误是:
WebSocket connection to 'wss://domain.com/websocket' failed: Error during WebSocket handshake: Unexpected response code: 503
我也有同样的问题,我的应用程序落后于nginx。 检查为我工作的Nginx配置
location / {
proxy_pass http://localhost:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}