A websocket connection for Blaze games
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:
cd path/Blaze
npm i
npm run example
Stable version:
npm i @viniciusgdr/Blaze
Or use the edge version
npm i github:viniciusgdr/Blaze
'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)
})
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
})