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

Tried to communicate with Palworld dedicated Linux Server #25

Open
neosmatrix321 opened this issue Feb 14, 2024 · 5 comments
Open

Tried to communicate with Palworld dedicated Linux Server #25

neosmatrix321 opened this issue Feb 14, 2024 · 5 comments

Comments

@neosmatrix321
Copy link

neosmatrix321 commented Feb 14, 2024

I try to connect to a Palworld dedicated linux server v0.1.4.1. this is my script:

import { Rcon } from "rcon-client"

const rcon = await Rcon.connect({
    host: "192.168.228.7", port: 25575, password: "pw"
});
rcon.on("authenticated", () => console.log("authenticated"));
// console.log(await rcon.send("Info"));

let responses = await Promise.all([
    rcon.send("Info"),
    rcon.send("Broadcast **OK_don-t_ignore_this_anyway_only_a_test**")
])

for (let response of responses) {
    console.log(response);
}

I get this error:

/home/websocket_client/node_modules/rcon-client/lib/rcon.js:117
reject(new Error(Timeout for packet id ${id}));
^

Error: Timeout for packet id 1
at Timeout._onTimeout (/home/websocket_client/node_modules/rcon-client/lib/rcon.js:117:28)
at listOnTimeout (node:internal/timers:569:17)
at process.processTimers (node:internal/timers:512:7)

Node.js v18.19.0

But the Broadcast gets still delievered and I can see the message on the server. I don't get any response from "Info" or "ShowPlayers" commands.
I tested many other clients, but sadly no client works for me.

I also use ARRCON shell utility, which is able to send & recieve messages from server without a problem.
Any chance to get this fixed?

Regards, Sascha

@janispritzkau
Copy link
Owner

Thanks for the report. I did mention in the README that this library was specifically built for Minecraft, but could you try the new alpha version anyway?

https://www.npmjs.com/package/rcon-client/v/5.0.0-alpha.2

I've changed and simplified the code quite a lot, so it should be worth a try.

@neosmatrix321
Copy link
Author

neosmatrix321 commented Feb 15, 2024

Hey, thanks for the reply. I know that this is optimized for minecraft server, but since the rcon protocoll is pretty universal, I thought I give it a try. I installed the alpha 2 and did some console.log modification (hope you don't mind). Think you will understand whats going on there.

id: 0 type: 3 payload Uint8Array(9) [
*, *, *, *,
*, *, *, *,
*
] message ******** # <--- my password
reqId 1
id: 1 type: 2 payload Uint8Array(4) [ 105, 110, 102, 111 ] message info
res {
id: 0,
type: 0,
message: 'Welcome to Pal Server[v0.1.4.1] Dator Community\n'
}
/home/websocket_client/node_modules/rcon-client/dist/client.js:85
throw new Error(Invalid response id (expected ${reqId}, got ${res.id}));
^

Error: Invalid response id (expected 1, got 0)
at RconClient.cmd (/home/websocket_client/node_modules/rcon-client/dist/client.js:85:23)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async file:///home/websocket_client/index.js:24:14

Node.js v18.19.0

EDIT: I've set the password request ID to 0, so he doen't count up the auth process id, it now works (atleast in this commandline tool) with this quick hack.

./index.js "info"
Welcome to Pal Server[v0.1.4.1] Dator Community

@janispritzkau
Copy link
Owner

janispritzkau commented Feb 15, 2024

Technically, since I process each command sequentially, I could use the same request ID everywhere. This issue sounds like a server bug. What exactly did you change in the client?

@neosmatrix321
Copy link
Author

neosmatrix321 commented Feb 15, 2024

diff /home/orig/node_modules/rcon-client/dist/client.js /home/websocket/node_modules/rcon-client/dist/client.js
47c47
<             const reqId = this.#nextReqId();
---
>             const reqId = 0;

EDIT: this works for me too

diff /home/orig/node_modules/rcon-client/dist/client.js /home/websocket_client/node_modules/rcon-client/dist/client.js
10c10
<     #reqId = 0;
---
>     #reqId = -1;
52c52
<             if (res.id == -1)
---
>             if (res.id == -2)

@likecyber
Copy link

likecyber commented Feb 24, 2024

It seems like Palworld's RCON implementation is different from Source's RCON Protocol.
It always returns ID: 0 for whatever ID you sent after you authorized.
Forcing ID to always be 0 seems to fix this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants