hmiiller / Blaze

A API For Blaze Games

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Blaze - TS/JS Blaze API

A websocket connection for Blaze games Blaze

Example

You can check at example.ts an event receiving usage model

To run the example, download or clone the repo and then type the following in terminal:

  1. cd path/Blaze
  2. npm i
  3. npm run example

Install

Stable version:

npm i @viniciusgdr/Blaze

Or use the edge version

  npm i github:viniciusgdr/Blaze

Handling Events

'authenticated': { success: boolean; subscribe: string[] }
'close': { code: number; reason: string; }

'crash.tick': CrashUpdate | CrashUpdateV2;
'double.tick': DoubleUpdate | DoubleUpdateV2;

'crash_waiting': CrashUpdate | CrashUpdateV2 | DoubleUpdate | DoubleUpdateV2;
'crash_graphing': CrashUpdate | CrashUpdateV2 | DoubleUpdate | DoubleUpdateV2;
'crash_complete': CrashUpdate | CrashUpdateV2 | DoubleUpdate | DoubleUpdateV2;

Example:

const socket = makeConnectionBlaze({
    type: 'crash', // or 'doubles'
})
socket.ev.on('game_complete', (msg) => {
    console.log(msg)
})

Notes

This option declared as "true" closes the socket when the match ends

const socket = makeConnectionBlaze({
    needCloseWithCompletedSession: boolean
})

You can set the interval time between sends that the socket is alive in blaze

const socket = makeConnectionBlaze({
    timeoutSendingAliveSocket: number
})

You can set the your token of blaze (Optional)

const socket = makeConnectionBlaze({
    token: string
})

This option declared as "true" limits you from repeating the same event several times in the round. so sending only once.

const socket = makeConnectionBlaze({
    requireNotRepeated: false
    // the default is true
})

Licence

MIT

About

A API For Blaze Games


Languages

Language:TypeScript 100.0%