2015-11-09 684 views
4

我正在嘗試使用帶有角度和heroku的websocket rails。它正在開發中,但現在正在生產中。這裏是發佈事件的服務器代碼和偵聽它的客戶端。在WebSocket握手期間出現錯誤:意外的響應代碼:503

#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 

回答

0

我有同樣的問題,我的應用程序背後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; 
} 
相關問題