ws-status

1.0.2 • Public • Published

CircleCI

WS Status & Op Code npm package

Utility to interact with Websocket status & Op Code. This library strictly follow the RFC6455

Usage

With this module, you can call it with a Status Code / Op Code or a message name.

StatusCode

  • The Status Code will return the message name
  • The Message name will return the Status Code

OpCode

  • The Op Code will return the message name
  • The Message name will return the Op Code

API

This module only map a message name constant to a code or the opposite It works for OpCode and StatusCode

API sample

const { StatusCode, OpCode } = require('ws-status');
 
//// StatusCode
// echo "Normal Closure"
console.log(StatusCode[1000]);
 
// echo 1000
console.log(StatusCode.NORMAL_CLOSURE);
 
//// OpCode
// echo "Ping frame"
console.log(OpCode[9]);
 
// echo 9
console.log(OpCode.PING);

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    1
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i ws-status

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

7.48 kB

Total Files

11

Last publish

Collaborators

  • oktapodia