Erlang/Elixir [Question] Cowboy2 实现 Server Send Events 遇到了个小问题

ChenZerong · October 30, 2017 · Last by ChenZerong replied at October 31, 2017 · 6318 hits

无其他特殊的业务逻辑代码,但每一分钟的时候都会被迫重连一次,希望有大佬解答。可能是我对 cowboy loop_handle 处理的理解有问题,萌新,见谅。

源码 & Logs

hmr.ex

Chrome DevTools Logs

console.error

http 和 websocket 都有个 idle_timeout,默认是 60s https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_websocket/ https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_http/

可以改长一点甚至是 :infinity

Reply to tony612

非常感谢,我一开始将这个idle_timeout理解成了会在每次传输后重新计时。

Reply to tony612

试了一下,cowboy_http 的 idle_timeout 选项虽然是timeout()类型,但现在并不支持:infinity, 刚刚开了个 issue, 作者也表示这是个 Bug。感谢 tony 大大,晚安。

You need to Sign in before reply, if you don't have an account, please Sign up first.