Linux unitednationsplay.com 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
nginx/1.20.1
Server IP : 188.130.139.92 & Your IP : 3.14.144.240
Domains :
Cant Read [ /etc/named.conf ]
User : web
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
home /
www /
wb /
node_modules /
socket.io-parser /
Delete
Unzip
Name
Size
Permission
Date
Action
dist
[ DIR ]
drwxrwxr-x
2022-08-30 11:49
CHANGELOG.md
3.31
KB
-rw-rw-r--
2022-08-30 11:49
LICENSE
1.08
KB
-rw-rw-r--
2022-08-30 11:49
Readme.md
2.33
KB
-rw-rw-r--
2022-08-30 11:49
package.json
1.4
KB
-rw-rw-r--
2022-08-30 11:49
Save
Rename
# socket.io-parser [](https://github.com/socketio/socket.io-parser/actions) [](http://badge.fury.io/js/socket.io-parser) A socket.io encoder and decoder written in JavaScript complying with version `5` of [socket.io-protocol](https://github.com/socketio/socket.io-protocol). Used by [socket.io](https://github.com/automattic/socket.io) and [socket.io-client](https://github.com/automattic/socket.io-client). Compatibility table: | Parser version | Socket.IO server version | Protocol revision | |----------------| ------------------------ | ----------------- | | 3.x | 1.x / 2.x | 4 | | 4.x | 3.x | 5 | ## Parser API socket.io-parser is the reference implementation of socket.io-protocol. Read the full API here: [socket.io-protocol](https://github.com/learnboost/socket.io-protocol). ## Example Usage ### Encoding and decoding a packet ```js var parser = require('socket.io-parser'); var encoder = new parser.Encoder(); var packet = { type: parser.EVENT, data: 'test-packet', id: 13 }; encoder.encode(packet, function(encodedPackets) { var decoder = new parser.Decoder(); decoder.on('decoded', function(decodedPacket) { // decodedPacket.type == parser.EVENT // decodedPacket.data == 'test-packet' // decodedPacket.id == 13 }); for (var i = 0; i < encodedPackets.length; i++) { decoder.add(encodedPackets[i]); } }); ``` ### Encoding and decoding a packet with binary data ```js var parser = require('socket.io-parser'); var encoder = new parser.Encoder(); var packet = { type: parser.BINARY_EVENT, data: {i: new Buffer(1234), j: new Blob([new ArrayBuffer(2)])}, id: 15 }; encoder.encode(packet, function(encodedPackets) { var decoder = new parser.Decoder(); decoder.on('decoded', function(decodedPacket) { // decodedPacket.type == parser.BINARY_EVENT // Buffer.isBuffer(decodedPacket.data.i) == true // Buffer.isBuffer(decodedPacket.data.j) == true // decodedPacket.id == 15 }); for (var i = 0; i < encodedPackets.length; i++) { decoder.add(encodedPackets[i]); } }); ``` See the test suite for more examples of how socket.io-parser is used. ## License MIT