@viniciusgdr/blaze
TypeScript icon, indicating that this package has built-in type declarations

2.3.2 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i @viniciusgdr/blaze

Weekly Downloads

0

Version

2.3.2

License

MIT

Unpacked Size

60.2 kB

Total Files

49

Last publish

Collaborators

  • viniciusgdr