0.1.25 • Published 7 months ago

@oof.gg/sdk v0.1.25

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
7 months ago

oof.gg SDK

This is the official oof.gg SDK for TypeScript/JavaScript. It allows you to interact with the oof.gg WSS/APIs.

Installation

npm i @oof.gg/sdk

Usage

import { GameSDK, SDKConfig } from '@oof.gg/sdk';
export const main = async () => {
  const sdkConfig: SDKConfig = {
    authUrl: '/auth',
    socketUrl: 'ws://0.0.0.0:9090',
    apiUrl: '/api'
  }

  const oof = new GameSDK(sdkConfig);

  const token = 'your-jwt-token';
  await oof.connect(token);

  // Socket events
  oof.events.websocket.game.emit('REGISTER_PLAYER', payload);
  oof.events.websocket.game.on('INIT', (data) => {
    console.log(data);
  });

  // Local events
  oof.events.local.on('ABORT', (data) => {
    console.log('ABORT event received:', data);
  });
  
  oof.events.local.on('STOP', (data) => {
    console.log('STOP event received:', data);
  });

  // Requests to App
  oof.events.local.emit('ABORT', {
    reason: 'User closed the game'
  });
}

TODO

  • Add more examples
  • Add more documentation
  • Authenticated requests
0.1.25

7 months ago

0.1.22

7 months ago

0.1.20

7 months ago

0.1.19

7 months ago

0.1.17

7 months ago

0.1.16

7 months ago

0.1.13

11 months ago

0.1.12

11 months ago

0.1.11

11 months ago

0.1.10

11 months ago

0.1.9

11 months ago

0.1.8

11 months ago

0.1.7

11 months ago

0.1.4

11 months ago

0.1.2

11 months ago