0.1.0 • Published 11 months ago

nengi-geckos-client-adapter v0.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

geckos.io client network adapter for nengi v2

Warning This adapter is written and tested only on nengi v2.0.0-alpha.133, this is an unstable version, the api of which may change in the future

Install

npm i nengi-geckos-client-adapter

Usage

Client-side

import { Client, Context } from "nengi";
import { GeckosClientAdapter } from "nengi-geckos-client-adapter";

const serverTickRate = 20;
const ctx = new Context();
// <...>
const client = new Client(ctx, GeckosClientAdapter, serverTickRate);

await client.connect("http://localhost:9001");

Or if you want to pass additional options to the geckos.io client use an alternative connection method:

const geckosOptions = {};
await(client.adapter as GeckosClientAdapter).connect(
  "http://localhost:9001",
  {}, // handshake
  geckosOptions
);

All available client options is described here https://github.com/geckosio/geckos.io#client-1

Server-side

For server-side you need nengi-geckos-server-adapter