@krp-races/krp-node-wrapper
v1.0.1
Published
A node.js wrapper for a dedicated or challenge server in kart racing pro.
Downloads
124
Maintainers
Readme
KRP Node Wrapper
A node.js wrapper for a dedicated or challenge server in kart racing pro.
Requirements
- None
Installing
This package was tested under Node.js 20.18.0 x64.
Kart Racing Pro release13e was used while testing.
pnpm add @krp-races/krp-node-wrapper
Supported Features
- Server Livetiming
- Server Remote Admin
API Documentation
LivetimingClient
Initialisation
import { LiveTimingClient } from "@krp-races/krp-node-wrapper";
const client = new LivetimingClient({
type: "udp4",
host: "127.0.0.1",
port: 5100,
password: "123",
trackPositions: 0,
collisions: 0,
});
console.log("Enable Livetiming Client");
client.setEnabled(true);
Methods
| Methods | Description | | ---------------------------- | ---------------------- | | setEnabled(enabled: boolean) | Set Client enabled. | | getEnabled() | Is Client enabled? | | getStatus() | Current Client status. |
Events
| Event | Description | | -------------- | --------------------- | | "connected" | Client connected. | | "disconnected" | Client disconnected. | | "data" | Client data update. | | "error" | Client error occured. |
client.on("data", (data) => {
console.log(data);
});
RemoteAdminClient
Important
The "QUIT" command will always lead to a timeout because the server doesn't answer afterwards.
Initialisation
import { RemoteAdminClient } from "@krp-races/krp-node-wrapper";
const client = new RemoteAdminClient({
type: "udp4",
host: "127.0.0.1",
port: 5100,
password: "123",
});
console.log("Enable Remote Admin Client");
client.setEnabled(true);
Methods
| Methods | Description | | ------------------------------------------------------- | ---------------------- | | setEnabled(enabled: boolean) | Set Client enabled. | | getEnabled() | Is Client enabled? | | getStatus() | Current Client status. | | sendCommand(command: 'QUIT' | 'MSG', message?: string) | Send command. |
client.sendCommand('QUIT');
client.sendCommand('MSQ', 'Hello World!);
Events
| Event | Description | | -------------- | --------------------- | | "connected" | Client connected. | | "disconnected" | Client disconnected. | | "error" | Client error occured. |
client.on("data", (data) => {
console.log(data);
});
Constribute
Guidelines are defined here.
License
Released under the AGPL-3.0 License.