# @gamefast/ching-sdk

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

Latest version **1.0.1** (published 2018-07-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install @gamefast/ching-sdk
pnpm add @gamefast/ching-sdk
yarn add @gamefast/ching-sdk
bun add @gamefast/ching-sdk
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2018-07-27 |
| First published | 2018-07-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 300 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | artakvg, varik77 |

## Links

- npm: https://www.npmjs.com/package/@gamefast/ching-sdk
- npm.io page: https://npm.io/package/@gamefast/ching-sdk

## Dependencies (1)

- [playio-client](https://npm.io/package/playio-client.md) ^0.0.4

## Recent versions

- 1.0.1 (latest) — 2018-07-27
- 1.0.0 — 2018-07-27

## README

## Client Usage Examle
```js
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'));
```

---
_Source: https://npm.io/package/@gamefast/ching-sdk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
