我在本地机器上使用 rails 应用程序,它工作正常。但我不能让它在生产服务器上工作。
我使用瘦和 nginx,因为我知道 nginx 不支持 websockets。有时我在日志中看到错误:“[Faye::RackAdapter] 输入必须是字符串或 IO”。我在 faye 中阅读了论坛并禁用了 websockets 添加行“Faye.Transport.WebSocket.isUsable = function(_,c) { c(false) };" 在 faye-browser.js 的末尾。
我在萤火虫中看到了这个帖子请求:
[{"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","interval ":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