【发布时间】:2012-06-02 18:57:05
【问题描述】:
我在本地机器上使用 rails 应用程序,它工作正常。但我不能让它在生产服务器上工作。
我使用 Thin 和 nginx,因为我知道 nginx 不支持 websockets。有时我在日志中看到错误:“[Faye::RackAdapter] 输入必须是字符串或 IO”。我在 faye 中阅读了论坛并禁用了 websockets 添加行“Faye.Transport.WebSocket.isUsable = function(_,c) { c(false) };" 在 faye-browser.js 的末尾。
我在 firebug 中看到这个帖子请求:
[{"id":"1","channel":"/meta/handshake","successful":true,"version":"1.0","supportedConnectionTypes":["long-polling"," cross-origin-long-polling","callback-polling","websocket","eventsource","in-process"],"clientId":"3q84u8vsc0mtdehob5dweh5nw","advice":{"reconnect":"retry" ,"间隔":0,"超时":45000}}]
还有这个:
[{"id":"2","clientId":"3q84u8vsc0mtdehob5dweh5nw","channel":"/meta/subscribe","successful":true,"subscription":"/queue/chat"}, {"id":"3","clientId":"3q84u8vsc0mtdehob5dweh5nw","channel":"/meta/connect","successful":true,"advice":{"reconnect":"retry","interval" :45000,"超时":0}}]
现在 faye 确实可以工作了,但是需要大约 30-60 秒来获取请求并更新页面。有没有办法减少检查间隔?
我的 nginx conf: http://pastie.org/3982274[Faye::RackAdapter] 输入必须是字符串或 IO
【问题讨论】:
标签: ruby-on-rails nginx websocket faye