CC: Tweaked

CC: Tweaked

42M Downloads

Websockets not working properly in NeoForge 1.21.1

Custodian19 opened this issue · 9 comments

commented

Minecraft Version

1.21.x

Version

1.113.0

Details

I have a websocket server, that works without issues on Fabric 1.20.4 and Higher, but when trying to use NeoForge (atleast in 1.21.1), the Client never connects.
It seems to be NeoForge, as even other (Real Life) Computers have the exact same problems.
I doubt the log file will say anything, but i could make a quick video clip demonstrating the issue.
latest.log

commented

There shouldn't be any difference between Fabric and NeoForge (nor indeed between 1.20.4 and 1.21.1), as all the code for HTTP requests is the same. That said, I guess it doesn't hurt to try and see if this works on Fabric 1.21.1.

where the Client expects something that my server doesn't send?

So typically issues in the past have been around the server requesting specific compression options (#958, #1394), though those should be fixed now. You could try connecting to your server with a different websocket client, and comparing the various protocol options it chooses compared with cloud-catcher or example.tweaked.cc.

Is your server code available anywhere?

commented

I'm using Python with "websockets" for the server. The example they give already has issues with the Neoforge version. I'm sending the client.lua and server.py in a zip, because Github doesn't allow those files.
testWebsocket.zip

commented

Thanks for the report. I'm afraid I'm unable to reproduce this.

Can you try with either try using cloud catcher and/or the example websocket code and see if either of those work? It's possible this is something specific to the server software you're using — I know sometimes Netty has issues with specific compression settings.

commented

Cloud Catcher seems to work, but it might also be that my server doesn't send something at the start the client expects?
The example works too, so i'm guessing that something changed between Neoforge and Fabric, where the Client expects something that my server doesn't send?

commented

Here is a video clip on what keeps happening on Fabric vs. Neoforge
(The Error that happens in the server code was just me being stupid and it still works. Besides, my actual code doesn't have THAT issue, but still the issue we are talking about here)
https://github.com/user-attachments/assets/b71ae931-5deb-4769-84a4-c0818bab0e39

commented

Ahh yeah, this does seem to be the compression issue. I'm not sure why this is NeoForge specific — will have a look (hah, typically it only happens in production, and not in dev). Your best option for now is to pass compression=None to serve, to disable compression entirely.

commented

Thanks! i'll try that!

commented

Okay! doing compression=None also worked to fix the issue.. But it makes sense that Forge is affected too, since they both are still pretty similar although still different enough..

commented

Ahh. It appears this this is an issue with Forge as well, not just NeoForge 1.21.

NeoForge attempts to load libraries in a fairly regimented order, with Minecraft's core libraries being loaded into a separate "layer" from any mods. This means that Minecraft's version of Netty cannot see the additional libraries it needs provides for handling compression.

We might be able to shadow our own relocated version of Netty to fix this, but I'm not sure how much work that's going to be, so afraid this may just end up being a "wontfix". I'll file a bug with NeoForge's mod loader (McModLauncher/modlauncher#131), but I'm fairly sure this is an intentional design choice.