@gamefast/ching-sdk

```js import Client from '@gamefast/ching-sdk';

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
@gamefast/ching-sdk
Minified + gzip package size for @gamefast/ching-sdk in KB

Readme

Client Usage Examle

import Client from '@gamefast/ching-sdk';

const client = new Client({
    host: '127.0.0.1',
    port: 3001,
    secure: false
});

/** Player */
/**
 * @param data Object
 * {
 *   status: Boolean,
 *   room: {
 *     players: [
 *          { id: id1, name: String, avatar: String, ....? },
 *     ],
 *     bet: Number,
 *     type: String,
 *     id: String,
 *     timer: Number
 *   }
 *
 * }
 * */


client.onPlayerSubscribe(data => {
    console.log('======SUBSCRIBE========')
    console.log(data);
    console.log('=======================');
    client.ready(true);
});

/**
 *
 * @param timer Number
 *
 * */


/** Room */
client.onGameStart((data) => {
    console.log("===========Game Start============");
    console.log(data)
});

/**
 *
 * @param winnerId? String
 * @param draw? Boolean
 * /..YOUR_API_RESPONSE_DATA../
 * */

client.onGameFinish(data => {
    console.log("===========Game Finish============");
    console.log(data)
});

/**
 *
 * @param player
 * {
 *  id: String
 * }
 *
 * */

client.onPlayerLeave(player => {
    console.log('===========ROOM PLAYER LEAVE========');
    console.log(player);
});

/**
 *
 * @param player
 * {
 *  id: String,
 *  status: Boolean
 * }
 *
 * */
client.onPlayerReady(console.log);

/**
 * @param status Boolean
 */

client.onPlayerJoinRoom(({ status }) => {
    console.log('============PLAYER JOIN ROOM==========');
    console.log(status);
});

/**
 * @description If both players skipped their turns, e.g. timer expired
 */

client.onMatchFinish(() => {
    console.log('============ROOM MATCH FINISH==========');
});

//** Socket Events
client.onConnect(() => console.log('SocketCluster onConnect'));
client.onDisconnect(() => console.log('SocketCluster onDisconnect'));

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.