ruby – 如何通过Thin / nginx访问事件机器websockets?

我有一个事件 – 机器websocket应用程序(使用
em-websocket宝石),它运行良好.问题是我需要使用端口80通过nginx部署它(不能用tcp代理模块编译它).是否可以使用指向瘦服务器的简单nginx proxy_pass并让瘦服务器将请求传递给我的websocket服务器? 最佳答案 根据我的理解,您无法使用proxy_pass代理websocket流量.

Since web sockets are done over HTTP 1.1 connections (where the handshake and upgrade are completed), your backend needs to support HTTP 1.1, and from what I have researched, they break the HTTP 1.0 spec…

我见过有些人尝试用socket.io和HAProxy做同样的事情(参见链接).我猜你可以尝试用socket -io替换em-websockets,并期望得到类似的结果.

1:http://www.letseehere.com/reverse-proxy-web-sockets

2:HAProxy + WebSocket Disconnection

点赞