{
  "name": "socket.io-parser",
  "version": "2.2.4",
  "description": "socket.io protocol parser",
  "repository": {
    "type": "git",
    "url": "https://github.com/Automattic/socket.io-parser.git"
  },
  "dependencies": {
    "debug": "0.7.4",
    "json3": "3.2.6",
    "component-emitter": "1.1.2",
    "isarray": "0.0.1",
    "benchmark": "1.0.0"
  },
  "devDependencies": {
    "mocha": "1.16.2",
    "expect.js": "0.2.0",
    "zuul": "1.6.3"
  },
  "scripts": {
    "test": "make test"
  },
  "license": "MIT",
  "readme": "\n# socket.io-parser\n\n[![Build Status](https://secure.travis-ci.org/Automattic/socket.io-parser.svg)](http://travis-ci.org/Automattic/socket.io-parser)\n[![NPM version](https://badge.fury.io/js/socket.io-parser.svg)](http://badge.fury.io/js/socket.io-parser)\n\nA socket.io encoder and decoder written in JavaScript complying with version `3`\nof [socket.io-protocol](https://github.com/learnboost/socket.io-protocol).\nUsed by [socket.io](https://github.com/learnboost/socket.io) and\n[socket.io-client](https://github.com/learnboost/socket.io-client).\n\n## Parser API\n\n  socket.io-parser is the reference implementation of socket.io-protocol. Read\n  the full API here:\n  [socket.io-protocol](https://github.com/learnboost/socket.io-protocol).\n\n## Example Usage\n\n### Encoding and decoding a packet\n\n```js\nvar parser = require('socket.io-parser');\nvar encoder = new parser.Encoder();\nvar packet = {\n  type: parser.EVENT,\n  data: 'test-packet',\n  id: 13\n};\nencoder.encode(packet, function(encodedPackets) {\n  var decoder = new parser.Decoder();\n  decoder.on('decoded', function(decodedPacket) {\n    // decodedPacket.type == parser.EVENT\n    // decodedPacket.data == 'test-packet'\n    // decodedPacket.id == 13\n  });\n\n  for (var i = 0; i < encodedPackets.length; i++) {\n    decoder.add(encodedPackets[i]);\n  }\n});\n```\n\n### Encoding and decoding a packet with binary data\n\n```js\nvar parser = require('socket.io-parser');\nvar encoder = new parser.Encoder();\nvar packet = {\n  type: parser.BINARY_EVENT,\n  data: {i: new Buffer(1234), j: new Blob([new ArrayBuffer(2)])}\n  id: 15\n};\nencoder.encode(packet, function(encodedPackets) {\n  var decoder = new parser.Decoder();\n  decoder.on('decoded', function(decodedPacket) {\n    // decodedPacket.type == parser.BINARY_EVENTEVENT\n    // Buffer.isBuffer(decodedPacket.data.i) == true\n    // Buffer.isBuffer(decodedPacket.data.j) == true\n    // decodedPacket.id == 15\n  });\n\n  for (var i = 0; i < encodedPackets.length; i++) {\n    decoder.add(encodedPackets[i]);\n  }\n});\n```\nSee the test suite for more examples of how socket.io-parser is used.\n\n\n## License\n\nMIT\n",
  "readmeFilename": "Readme.md",
  "bugs": {
    "url": "https://github.com/Automattic/socket.io-parser/issues"
  },
  "_id": "socket.io-parser@2.2.4",
  "_from": "socket.io-parser@2.2.4"
}
