sync client and settimeout()
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 419
- Forks
- 117
- PR merge metrics
- No merged PRs in 30d
Description
I am using the sync client, receiving about 30 msgs/sec. I don't want to get stuck waiting if there is no data ready, so i am trying this:
``` lua
ws.sock:settimeout(0)
local message, opcode, close_was_clean, close_code, close_reason = ws:receive()
ws.sock:settimeout()
```
My idea/hope being that if there is no data available, it will fail and return me nil or some such and then i will do my other job and keep polling from time to time till i get something. I get nil - HOWEVER it also seems to close the connection, so i never really receive anything!
From my point of view seems like a bug. What can i do?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the sync-client sequence shown in the issue: set the socket timeout to 0, call ws:receive(), then restore the timeout. Inspect how a nil result is handled and verify whether the connection remains usable for later polling; done means an empty read does not close the connection and subsequent messages can still be received.
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