# shocked-client

> Socket Client

Latest version **1.0.11** (published 2018-11-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install shocked-client
pnpm add shocked-client
yarn add shocked-client
bun add shocked-client
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.0.11 |
| Published | 2018-11-02 |
| First published | 2018-05-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 39.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Ranjan Shrestha |
| Maintainers | syaau |

## Links

- npm: https://www.npmjs.com/package/shocked-client
- Repository: https://github.com/bhoos/socket/tree/master/client
- npm.io page: https://npm.io/package/shocked-client

## Dependencies (2)

- [events](https://npm.io/package/events.md) ^3.0.0
- [shocked-common](https://npm.io/package/shocked-common.md) ^1.0.11

## Recent versions

- 1.0.11 (latest) — 2018-11-02
- 1.0.10 — 2018-09-21
- 1.0.8 — 2018-09-20
- 1.0.6 — 2018-08-14
- 0.3.12 — 2018-08-08
- 0.3.11 — 2018-08-07
- 0.3.8 — 2018-08-06
- 0.3.7 — 2018-08-06
- 0.3.6 — 2018-08-05
- 0.3.5 — 2018-07-19
- 0.3.2 — 2018-07-13
- 0.3.1 — 2018-07-13
- 0.2.18 — 2018-06-27
- 0.2.17 — 2018-06-19
- 0.2.16 — 2018-06-18
- … 5 more at https://npm.io/package/shocked-client/versions

## README

# shocked-client
This library provides internal implementation for client
side web socket connection. It is used by `shocked-react`
to provide a seamless integration to connect with server
side api.

You should use `shocked-react` for your react applications.
Use this library as a lower level api.

## Installation
> `$ npm install shocked-client`

or

> `$ yarn add shocked-client`

## Available apis with shocked-client
### `createClient(host, WebSocket)`
Creates a long live client instance available for connecting
to the remove host. The client has the following methods
available:
#### `client.connect(path)`
Establish connection to remote host at the given path

#### `client.isConnected()`
Get current client status

#### `client.close()`
Close a client connection if any

#### `client.send()`
Send raw data to the remote host

#### `client.createTracker(trackerId, store, params)`
Create a tracker to track content on server. The remote tracker
then dispatches action directly to the given store. Provide
initial params for the tracker if any.
  * `tracker.close` - Close the tracker when it's not required any more.
  * `tracker.createApi` - to bind remote api to the client


#### `client.on(event, listener)`
Listen for client events - connect, disconnect.

#### `client.off(event, listener)`
Remove event listener added to clients

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