photon-packet-parser
v0.0.19
Published
Photon Packet Parser is a Node.js library for parsing Photon Protocol 16 packets.
Downloads
25
Readme
Photon Packet Parser
Photon Packet Parser is a Node.js library for parsing Photon Protocol 16 packets. It provides tools for deserializing Photon commands and packets, making it easier to handle Photon-based communication in your Node.js applications.
Installation
You can install the library via npm:
npm install photon-packet-parser
Usage
Here's an example of how to use the Photon Packet Parser:
const PhotonPacketParser = require('photon-packet-parser');
const parser = new PhotonPacketParser();
parser.on('packet', (packet) => {
console.log('Packet received:', packet);
});
const sampleBuffer = Buffer.from(/*your-packet-data-here*/);
parser.handle(sampleBuffer);
Classes
PhotonCommand
Parses individual Photon commands from a payload.
PhotonPacket
Parses Photon packets which can contain multiple commands.
PhotonPacketParser
Main parser class that handles incoming packet buffers.
Protocol16Deserializer
Deserializes different types of data based on Photon Protocol 16.
Events
packet
: Emitted when a packet is parsed successfully.request
: Emitted when an operation request is parsed.response
: Emitted when an operation response is parsed.event
: Emitted when an event is parsed.
License
This project is licensed under the MIT License.