-
-
Notifications
You must be signed in to change notification settings - Fork 240
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
Adding custom latency delay #1005
Comments
You can make this by using a proxy to connect to a server. Then relay the packets after a certain delay. Or you can overwrite the write function off a client or server and replace it with a dummy function that takes the arguments and writes them after a while. Delaying packets can cause instability tho. |
So I forked the repo, and used If you have time, could you care to elaborate why this is happening and what a possible remedy may be? I may just end up writing a proxy, seems like the most hassle free solution... you can view my changes to client.js here |
You can use the proxy example and change this line to use something like setTimeout to delay the write
Or you can do something like this const client = createClient(...)
const originalWrite = client.write
client.write = (...args) => {
setTimeout(() => {
originalWrite(...args)
}, 500)
} |
I'm experimenting with latency and how it affects Minecraft clients and servers.
What would be the easiest way to introduce "fake" latency between a node-minecraft-protocol client and a java server?
Essentially I'm thinking of something like being able to delay all packet writes by a custom
spoofedLatency
field.Any way to currently do this? Where should I look if I wanted to implement such a feature?
The text was updated successfully, but these errors were encountered: