@chipsgg/openservice-ws-client

2.0.0 • Public • Published

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
const WS = require("ws");

const channels = ["public", "private", "auth", "community"];

Client(WS, { channels }).then(async ({ state, actions }) => {
	// do somthing	

	await actions.public('echo', { message: 'hello world!' })
		.then(console.log)
		.catch(console.error)

	await actions.community('on', { topic: 'chats', path: ['public'] })

	state.on('community.chats.public', console.log)
})

Readme

Keywords

none

Package Sidebar

Install

npm i @chipsgg/openservice-ws-client

Weekly Downloads

23

Version

2.0.0

License

none

Unpacked Size

77.2 kB

Total Files

6

Last publish

Collaborators

  • tacyarg