lua-resty-websocket icon indicating copy to clipboard operation
lua-resty-websocket copied to clipboard

"send_text" got no error meesage after browser closed

Open rttw opened this issue 2 years ago • 1 comments

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

rttw avatar Mar 14 '22 00:03 rttw

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

cppcoffee avatar Mar 22 '22 12:03 cppcoffee