openresty / openresty/lua-resty-websocket

"send_text" got no error meesage after browser closed

Open
#70 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
523
Forks
112
Avg merge
1d 16m
Merged PRs (30d)
2

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the send_text call in the provided Lua reproduction and trace how it handles a browser closing during the tail -f loop. Reproduce the Chrome or Edge disconnect, then verify that send_text reports zero bytes and an error such as a closed client connection instead of reporting success.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.