@viniciusgdr/blaze
v3.0.1
Published
A websocket connection for Blaze games <img src="/media/blaze.png" alt="Blaze"/>
Downloads
4
Readme
Blaze - TS/JS Blaze API
A websocket connection for Blaze games
Install
Stable version:
npm i @viniciusgdr/Blaze
Or use the edge version
npm i github:viniciusgdr/Blaze
Handling Events
'close': { code: number; reconnect: boolean; }
'crash.tick'
'double.tick'
'subscriptions': string[]
// On enabled cacheIgnoreRepeatedEvents, the event will be sent only once. If you want to receive the event repeatedly, you can use: (or disable the cacheIgnoreRepeatedEvents)
'CB:crash.tick'
'CB:double.tick'
Example:
const socket = makeConnection({
type: 'crash', // "crash" | "doubles" | "crash_2"
})
socket.ev.on('crash.tick', (msg) => {
console.log(msg)
})
Notes
You can set the your token of blaze (Optional)
const socket = makeConnection({
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 = makeConnection({
cacheIgnoreRepeatedEvents: false
// the default is true
})