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.
You can install the library via npm:
npm install photon-packet-parser
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);
Parses individual Photon commands from a payload.
Parses Photon packets which can contain multiple commands.
Main parser class that handles incoming packet buffers.
Deserializes different types of data based on Photon Protocol 16.
-
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.
This project is licensed under the MIT License.