ajb*_*aus 5 ruby-on-rails heroku websocket-rails
我正在尝试将websocket导轨与angular和heroku一起使用。它正在开发中,但现在正在生产中。这是发布事件的服务器代码以及侦听事件的客户端。
#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;
});
});
Run Code Online (Sandbox Code Playgroud)
我正在生产SSL。我已经尝试过设定
force_ssl = false
Run Code Online (Sandbox Code Playgroud)
在中production.rb
,但无济于事。
我得到的错误是:
WebSocket connection to 'wss://domain.com/websocket' failed: Error during WebSocket handshake: Unexpected response code: 503
Run Code Online (Sandbox Code Playgroud)
我遇到了同样的问题,我的应用程序位于 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;
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3003 次 |
最近记录: |