關於websocket,如果client端關閉browser,server端程式似乎會被中斷。

93 views
Skip to first unread message

Taylor Tang

unread,
Jan 15, 2015, 11:09:28 PM1/15/15
to open...@googlegroups.com
想用openresty試著練習寫個chatroom,在離開時會對其他使用者送訊息"XXX已經離開聊天室"和存一些資料到redis,
如果使用者送出close訊息但是沒關閉瀏覽器能正常運作,但如果是直接把borwser關閉,無限迴圈break後的lua code有似乎時會執行到一半就中斷了。
請問有沒有比較好的解決方式?

目前環境是win7 cygwin32,不知是否和這些有關係。

Thanks

张伟

unread,
Jan 16, 2015, 12:32:57 AM1/16/15
to open...@googlegroups.com
http://wiki.nginx.org/HttpLuaModule#lua_check_client_abort
See also ngx.on_abort.

使用 lua_check_client_abort
并注册 ngx.on_abort 回调



--
--
邮件来自列表“openresty”,专用于技术讨论!
订阅: 请发空白邮件到 openresty...@googlegroups.com
发言: 请发邮件到 open...@googlegroups.com
退订: 请发邮件至 openresty+...@googlegroups.com
归档: http://groups.google.com/group/openresty
官网: http://openresty.org/
仓库: https://github.com/agentzh/ngx_openresty
教程: http://openresty.org/download/agentzh-nginx-tutorials-zhcn.html

Reply all
Reply to author
Forward
0 new messages