npm.io
1.3.0 • Published 2 weeks ago

@websocketpie/client

Licence
MIT
Version
1.3.0
Deps
1
Size
56 kB
Vulns
0
Weekly
0

NPM: @websocketpie/client

A client for connecting to, sending and receiving messages from a @websocketpie/server instance.

This package is a client that abstracts @websocketpie/server's public API behind simple publicly exported methods.

Getting started, simplest usage:

import PieClient from '@websocketpie/client';

const pie = new PieClient();
pie.onData = x => console.log('onData:', x.payload);
await pie.quickConnect('ws://localhost:8000');
pie.sendData("hello multi-user world");

Extras

Add <div id='websocketpie-connection-status'></div> to the page to have @websocketpie/client automatically update it with the connection status