openresty / lua-resty-websocket

WebSocket support for the ngx_lua module (and OpenResty)
508 stars 106 forks source link

"send_text" got no error meesage after browser closed #70

Open rttw opened 2 years ago

rttw commented 2 years ago

my lua code is just like this:

local file = io.popen("tail -f /var/log/ping.log") for line in file:lines() do local bytes, err = wb:send_text(line) ngx.log(ngx.INFO, "LINE SENDED:",line,":",bytes,":",err)

if not bytes then
     ngx.log(ngx.ERR, "failed to send a text frame: ", err)
    return ngx.exit(444)
end

end file:close()

after my browser(chrome/edge) closed,the "send_text" still return bytes and no error,which I hope a zero bytes and error msage like "the client connection is closed"

need help

cppcoffee commented 2 years ago

Hi @rttw , you can try to capture the packets using tcpdump to determine if the server is disconnected?