ruby-on-rails – WebSocket握手期间出错:意外的响应代码:503
发布时间:2020-12-17 01:56:12 所属栏目:百科 来源:网络整理
导读:我正在尝试使用带角度和heroku的websocket导轨.它正在开发中,但现在正在生产中.这是发布事件的服务器代码和侦听它的客户端. #ServerWebsocketRails[channel_name].trigger('new_message',@json)//Clientvar dispatcher = new WebSocketRails(window.location
我正在尝试使用带角度和heroku的websocket导轨.它正在开发中,但现在正在生产中.这是发布事件的服务器代码和侦听它的客户端.
#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; } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |