@chipsgg/openservice-ws-client
v4.0.0
Published
Websocket client for openservice-ws-server
Readme
Openservice Websocket Client
Websocket client for openservice-ws-server.
Install
yarn add @chipsgg/openservice-ws-client
Geting Started
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.
actions.public.ping()
.then(console.log)
.catch(console.error)
