craftos2
craftos2 copied to clipboard
`http.Websocket.receive()` hangs, or reports the websocket is closed
Describe the bug
When using websockets on the latest nightly (25/8/2021), http.Websocket.receive()
either errors with attempt to use a closed file
, or it just hangs and does nothing.
To Reproduce Steps to reproduce the behavior:
- Open the Lua REPL
- Make a websocket
s,err = http.websocket("wss://leveloper.cc/ws")
(Replace leveloper.cc with any websocket echo of your choosing)
To get the closed file
error:
-
s.send("string")
-
s.receive()
- You now have the closed file error
To get the websocket to hang:
-
s.send("string") return s.receive()
- You now have a hung Lua REPL
Expected behavior For the first one I expected the websocket to still be "open" (Of note: The websocket connection never actually closes on the server), and let me read the response from it. For the second one I expected the websocket to just return a response.
Screenshots
(server side log)
Ready
Websocket Connection
Got ws response
Prepared request
bruh
Websocket Connection
Got ws response
Prepared request
bruh
Websocket Connection
Got ws response
Prepared request
bruh
Websocket Connection
Got ws response
Prepared request
bruh
Environment (please complete the following information):
- OS: Windows 10
- OS Version: 20H2 build 19042.1165
- CraftOS-PC Version: Nightly 25/8/2021
- Compiled from source? No
I'm unable to reproduce this issue in the latest build, though I recall having issues a few days ago. Could you try reproducing this again on your system, using the latest nightly?
Downloaded latest nightly (27/08/2021) and I get the error `The code execution cannot proceed because libwebpmux.dll was not found. Reinstalling the program may fix this problem.
As far as I'm aware, I don't think theres an installer that installs this DLL, so I don't entirely know what to do here. Do you have a source for this specific DLL?
Ah yes, the latest build adds WebP support, so it needs the libraries. Here you go.
Downloaded the libraries, stuck em into the CraftOS-PC folder, tried to launch and I get this.
Updating to version 2.6.1 has no effect on hanging/erroring with closed file.
This should be fixed as of b0d4a66d20c74c343ff2992feb1ff2e2dd07906d and df54896f64d08f51d991d5af4f1e745785727cd5.