Skip to content

uuuulopta/websocket-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Work in progress.

Usage

Install with npm install nodejs-websocket-parser

Import package

import * as net from "net"
import { WebsocketParser } from "nodejs-websocket-parser/dist/WebsocketParser"

Initialize parser

const wsp = new WebsocketParser()

On socket connection, add it to the parser

wsp.addConnection(socket)

On socket disconnect, remove it

wsp.removeConnection(socket)

When you recieve data from socket parse it with

wsp.parse(data,socket)

Handle parsed data with

wsp.on("text",(data) => {console.log(data)})  
wsp.on("binary",(data) => {console.log(data)})

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published