Git Product home page Git Product logo

blaze_websocket's Introduction

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

blaze_websocket's People

Contributors

viniciusgdr avatar dakauann avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.