Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Websockets not working properly in NeoForge 1.21.1 #1958

Closed
Custodian19 opened this issue Aug 29, 2024 · 9 comments
Closed

Websockets not working properly in NeoForge 1.21.1 #1958

Custodian19 opened this issue Aug 29, 2024 · 9 comments
Labels
area-Core This affects CC's core (the Lua runtime, APIs, computer internals). bug A problem or unexpected behaviour with the mod.

Comments

@Custodian19
Copy link

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

@Custodian19 Custodian19 added the bug A problem or unexpected behaviour with the mod. label Aug 29, 2024
@cc-tweaked cc-tweaked deleted a comment Aug 29, 2024
@SquidDev SquidDev added cannot reproduce I'm unable to reproduce this bug. area-Core This affects CC's core (the Lua runtime, APIs, computer internals). labels Aug 29, 2024
@SquidDev
Copy link
Member

SquidDev commented Aug 29, 2024

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.

@Custodian19
Copy link
Author

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?

@SquidDev
Copy link
Member

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?

@Custodian19
Copy link
Author

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

@Custodian19
Copy link
Author

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

@SquidDev
Copy link
Member

SquidDev commented Aug 29, 2024

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.

@Custodian19
Copy link
Author

Thanks! i'll try that!

@SquidDev SquidDev added wontfix A bug which I won't fix or an enhancement which won't be implemented. and removed cannot reproduce I'm unable to reproduce this bug. wontfix A bug which I won't fix or an enhancement which won't be implemented. labels Aug 29, 2024
@SquidDev
Copy link
Member

SquidDev commented Aug 29, 2024

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.

@Custodian19
Copy link
Author

Custodian19 commented Aug 29, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Core This affects CC's core (the Lua runtime, APIs, computer internals). bug A problem or unexpected behaviour with the mod.
Projects
None yet
Development

No branches or pull requests

2 participants