craftos2 icon indicating copy to clipboard operation
craftos2 copied to clipboard

`http.Websocket.receive()` hangs, or reports the websocket is closed

Open SkyTheCodeMaster opened this issue 2 years ago • 6 comments

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:

  1. Open the Lua REPL
  2. 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 image (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

SkyTheCodeMaster avatar Aug 26 '21 14:08 SkyTheCodeMaster

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?

MCJack123 avatar Aug 28 '21 01:08 MCJack123

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. image

SkyTheCodeMaster avatar Aug 28 '21 16:08 SkyTheCodeMaster

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?

SkyTheCodeMaster avatar Aug 28 '21 16:08 SkyTheCodeMaster

Ah yes, the latest build adds WebP support, so it needs the libraries. Here you go.

MCJack123 avatar Aug 28 '21 17:08 MCJack123

Downloaded the libraries, stuck em into the CraftOS-PC folder, tried to launch and I get this. image

SkyTheCodeMaster avatar Aug 29 '21 03:08 SkyTheCodeMaster

Updating to version 2.6.1 has no effect on hanging/erroring with closed file. image

SkyTheCodeMaster avatar Aug 31 '21 22:08 SkyTheCodeMaster

This should be fixed as of b0d4a66d20c74c343ff2992feb1ff2e2dd07906d and df54896f64d08f51d991d5af4f1e745785727cd5.

MCJack123 avatar Jan 26 '23 06:01 MCJack123