Hello!
2012/12/8 Zheng Ping:
>
> 初学openresty,有个问题不解,对于comet或SSE这种服务端向浏览器推送的技术,当浏览器断开连接时我怎样在lua代码中判断呢,
请参见 ngx_lua 的文档中关于 lua_check_client_abort 配置指令和 ngx.on_abort() 函数的段落:
http://wiki.nginx.org/HttpLuaModule#lua_check_client_abort
http://wiki.nginx.org/HttpLuaModule#ngx.on_abort
另外,正如上面的文档已经提及的,建议同时启用你的系统的 TCP 协议栈的 TCP keepalive 支持(注意,这里说的不是 HTTP
keepalive!),以及时检测出 half-open 状态的 TCP 连接。
Best regards,
-agentzh