1.0.6 • Published 11 months ago

@krp-races/krp-node-wrapper v1.0.6

Weekly downloads
-
License
AGPL-3.0-only
Repository
github
Last release
11 months ago

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

MethodsDescription
setEnabled(enabled: boolean)Set Client enabled.
getEnabled()Is Client enabled?
getStatus()Current Client status.

Events

EventDescription
"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

MethodsDescription
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

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

1.0.6

11 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

1 year ago

1.0.0

1 year ago