简体   繁体   English

使用Websockets部署Thin

[英]Deploying Thin with Websockets

I am attempting to deploy a Ruby on Rails application that is being served via Thin. 我正在尝试部署通过Thin提供的Ruby on Rails应用程序。 The application uses websockets, specifically the websocket-rails library. 该应用程序使用websockets,特别是websocket-rails库。

This works locally. 这在本地工作。 When attempting to deploy, it does not work. 尝试部署时,它不起作用。 The websocket server is not a standalone application - the websockets are simply part of the main application server. websocket服务器不是独立的应用程序 - websockets只是主应用程序服务器的一部分。 When my javascript creates a connection to the webserver, I see the following in my production.log: 当我的javascript创建与Web服务器的连接时,我在production.log中看到以下内容:

[2014-11-02T23:38:19.942236 #9154]  INFO -- : Started GET "/websocket" for <IP ADDRESS> at 2014-11-02 23:38:19 +0000

There is nothing else related to the websocket request in production.log. 在production.log中没有与websocket请求相关的其他内容。 In my websocket_rails.log, I see: 在我的websocket_rails.log中,我看到:

[32mConnectionManager^[[0m] Connection opened: #<Connection::b2b0d6b0e3faa4432b0c>
[32mConnectionManager^[[0m] Connection closed: #<Connection::b2b0d6b0e3faa4432b0c>

Showing that the request did reach the websocket code, and the connection was promptly closed. 显示请求确实到达websocket代码,并且连接已立即关闭。 In the browser, I see the 在浏览器中,我看到了

WebSocket connection to 'ws:/<DOMAIN>/websocket' failed: Error during WebSocket handshake:  Unexpected response code: 200

I have found very limited information regarding this error. 我发现有关此错误的信息非常有限。 Is there an easy way to debug these errors? 有没有简单的方法来调试这些错误? Inspecting the data in Chrome Inspector shows the following for the request to /websocket: 检查Chrome Inspector中的数据会显示以下对/ websocket的请求: 在此输入图像描述

I'd like to think I'm missing a simple configuration but have to discover what that might be. 我想我错过了一个简单的配置,但必须发现它可能是什么。 Any ideas? 有任何想法吗?

Thanks! 谢谢!

I had a thin server running on my local machine to run an app, and it didn't work when I deployed to production. 我在我的本地计算机上运行了一个瘦服务器来运行应用程序,当我部署到生产环境时它没有用。 I had to set up a separate app on Heroku just to run a separate server. 我不得不在Heroku上设置一个单独的应用程序,只是为了运行一个单独的服务器。 Maybe this would work for you? 也许这对你有用吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM