knockoutcity-sdk
TypeScript icon, indicating that this package has built-in type declarations

1.20.1 • Public • Published

KnockoutCity SDK

Version License

A developer friendly unofficial SDK for the private server build of KnockoutCity.

Note
This project is currently in alpha and is undergoing heavy development.

Features

  • Authenticate with a private server (with some limitations)
  • Listening to various Server Events (e.g. group joins, invites, ...)
  • Sending various Commands to the Server (e.g. group invites, match making, ...)

Limitations

  • Authentication is currently only possible to private servers. For authentication proxy servers (e.g. KOCity-Proxy) you can use the KnockoutCity Auth Client to get the credentials.
  • Joining Gameserver is currently not possible but will hopefully become a feature when the VNET0 Protocol has been reverse engineered.

Installation

Use your prefered package manager to install knockoutcity-sdk.

# NPM
npm install knockoutcity-sdk

# Yarn
yarn knockoutcity-sdk

# PNPM
pnpm install knockoutcity-sdk

Usage

// Using required
const kocSDK = require('knockoutcity-sdk');

// Using import
import * as kocSDK from 'knockoutcity-sdk'
// or
import { ... } from 'knockoutcity-sdk'

Also make sure to check the examples for detailed examples on the usage and possibilities of this sdk.

Connecting to a Server

import { authenticate, KOCWebsocketClient } from 'knockoutcity-sdk';

const BASE_URL = 'http://127.0.0.1:23600';

const kocWebsocketClient = new KOCWebsocketClient(BASE_URL);
const { token } = await authenticate(BASE_URL, 'USERNAME');

// ... register listeners

await kocWebsocketClient.connect(token);

// ... emit events

Listening to Events

kocWebsocketClient.on('EVENT NAME', (data) => {
  // ...
});

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

GNU GPLv3

Readme

Keywords

none

Package Sidebar

Install

npm i knockoutcity-sdk

Weekly Downloads

129

Version

1.20.1

License

GNU GPLv3

Unpacked Size

193 kB

Total Files

325

Last publish

Collaborators

  • tandashi