A developer friendly unofficial SDK for the private server build of KnockoutCity.
Note
This project is currently in alpha and is undergoing heavy development.
- 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, ...)
- 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.
Use your prefered package manager to install knockoutcity-sdk
.
# NPM
npm install knockoutcity-sdk
# Yarn
yarn knockoutcity-sdk
# PNPM
pnpm install knockoutcity-sdk
// 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.
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
kocWebsocketClient.on('EVENT NAME', (data) => {
// ...
});
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.