websocket-request

1.2.3 • Public • Published

websocket-request

About

Made websocket to Request response mode.

Imitate the request and response mode of HTTP, send a request and wait for the response to return.

How use

npm

npm i websocket-request --save

yarn

yarn add websocket-request -S

example

 
const WS = require("websocket-request");

async function test(){
  const ws = new WS('ws://localhost');
  await ws.open();
  let res=await ws.request('data');
  console.log(res);
}

test().then(()=>{});

Package Sidebar

Install

npm i websocket-request

Weekly Downloads

1

Version

1.2.3

License

MIT

Unpacked Size

3.62 kB

Total Files

4

Last publish

Collaborators

  • lanmeng2022