# Openservice Websocket Client

Websocket client for openservice-ws-server.

## Install

`yarn add @chipsgg/openservice-ws-client`

## Geting Started

```js
import Client from "@chipsgg/openservice-ws-client";

//websockets must be supported in browser

//your action/state channels, this is dependent on your server implementation
const channels = [
  "public",
  "private",
  "auth",
]

let { actions, connect } = await Client(
    WebSocket,
    {
      host: host || process.env.SOCKET,
      channels,
      keepAlive: 1000,
    },
    (type, state) => {
      console.log('socket.event', type, state)
    }
  )
```

## API

### actions

RPC interface for server actions api.

```js
actions.public.ping()
  .then(console.log)
  .catch(console.error)

```
