HomeGamesServers

Hello World!

This example show how you can listen for when a player uses the chat in the game server.

Setup your game server

Your game server, regardless of how you set it up, needs to interact with the GaminAPI network. To do this use one of the following setups:
Use docker to run the Rust server using the official GamingAPI Rust docker image.
docker run 
  -d
  -e RUST_RCON_PASSWORD='1234'
  -e GAMINGAPI_SERVER_ID='101'
  -e GAMINGAPI_NATS_NKEY_USER='UCI2NCSIEV3DXLYYR5KQXYCZ7CIW4KYXHLSGXJOZ7TSRRKHP2BM5IVMU'
  -e GAMINGAPI_NATS_NKEY_SEED='SUAHZGQCK3PKMY5JBY2PBJUK2SA2IAGNX7VXYQJ75MLIU2IWQE235OBLJM'
  -p 28016:28016
  -p 28015:28015
  -v ./rust:/steamcmd/rust
  ghcr.io/gamingapi/rust-docker-image:latest

Interact with your sever

Next, find your favorite supported language to interact with the game server.
First, install one of the helper libraries that lets you interact with the game server with few lines of code.
npm install @eventgamingapi/rust
import { NatsAsyncApiClient } from '@eventgamingapi/rust';

const client = new NatsAsyncApiClient();
await client.connect();
await client.subscribeToRustServerStarted((message) => {
  console.log(`Server have started`)
});