Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

engine.io-parser

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

engine.io-parser

Parser for the client for the realtime Engine

  • 1.0.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7.3M
decreased by-12.51%
Maintainers
1
Weekly downloads
 
Created

What is engine.io-parser?

The engine.io-parser npm package is designed for encoding and decoding packets used by engine.io, which is a transport layer for real-time data exchange between a client and a server. It handles the framing of messages for transport over various real-time protocols and supports binary data.

What are engine.io-parser's main functionalities?

Encoding messages

This feature allows you to encode a message packet into a format suitable for transport over the network. The `encodePacket` function takes a packet object and a callback function that receives the encoded packet.

const { encodePacket } = require('engine.io-parser');
const packet = { type: 'message', data: 'hello' };
encodePacket(packet, false, (encodedPacket) => {
  // handle the encoded packet
});

Decoding messages

This feature allows you to decode a message packet that was received from the network. The `decodePacket` function takes an encoded packet and the type of data ('string' or 'binary') and returns the decoded packet object.

const { decodePacket } = require('engine.io-parser');
const encodedPacket = '2hello'; // example of an encoded message packet
const packet = decodePacket(encodedPacket, 'string');
// handle the decoded packet

Support for binary data

This feature provides support for encoding and decoding binary data. The `encodePacket` and `decodePacket` functions can handle binary data when the second argument is set to `true` for binary.

const { encodePacket, decodePacket } = require('engine.io-parser');
const binaryData = new ArrayBuffer(100);
const packet = { type: 'message', data: binaryData };
encodePacket(packet, true, (encodedPacket) => {
  // handle the encoded packet with binary data
});
const decodedPacket = decodePacket(encodedPacket, 'binary');
// handle the decoded packet with binary data

Other packages similar to engine.io-parser

FAQs

Package last updated on 30 May 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc