{
  "_args": [
    [
      {
        "raw": "ws@https://registry.npmjs.org/ws/-/ws-1.1.1.tgz",
        "scope": null,
        "escapedName": "ws",
        "name": "ws",
        "rawSpec": "https://registry.npmjs.org/ws/-/ws-1.1.1.tgz",
        "spec": "https://registry.npmjs.org/ws/-/ws-1.1.1.tgz",
        "type": "remote"
      },
      "/Users/roblou/code/vscode-node-debug2"
    ]
  ],
  "_from": "ws@>=1.1.1 <2.0.0",
  "_id": "ws@1.1.1",
  "_inCache": true,
  "_location": "/ws",
  "_phantomChildren": {},
  "_requested": {
    "raw": "ws@https://registry.npmjs.org/ws/-/ws-1.1.1.tgz",
    "scope": null,
    "escapedName": "ws",
    "name": "ws",
    "rawSpec": "https://registry.npmjs.org/ws/-/ws-1.1.1.tgz",
    "spec": "https://registry.npmjs.org/ws/-/ws-1.1.1.tgz",
    "type": "remote"
  },
  "_requiredBy": [
    "/",
    "/vscode-chrome-debug-core"
  ],
  "_resolved": "https://registry.npmjs.org/ws/-/ws-1.1.1.tgz",
  "_shasum": "082ddb6c641e85d4bb451f03d52f06eabdb1f018",
  "_shrinkwrap": null,
  "_spec": "ws@https://registry.npmjs.org/ws/-/ws-1.1.1.tgz",
  "_where": "/Users/roblou/code/vscode-node-debug2",
  "author": {
    "name": "Einar Otto Stangvik",
    "email": "einaros@gmail.com",
    "url": "http://2x.io"
  },
  "bugs": {
    "url": "https://github.com/websockets/ws/issues"
  },
  "dependencies": {
    "options": ">=0.0.5",
    "ultron": "1.0.x"
  },
  "description": "simple to use, blazing fast and thoroughly tested websocket client, server and console for node.js, up-to-date against RFC-6455",
  "devDependencies": {
    "ansi": "0.3.x",
    "benchmark": "0.3.x",
    "bufferutil": "1.2.x",
    "expect.js": "0.3.x",
    "istanbul": "^0.4.1",
    "mocha": "2.3.x",
    "should": "8.0.x",
    "tinycolor": "0.0.x",
    "utf-8-validate": "1.2.x"
  },
  "gypfile": true,
  "homepage": "https://github.com/websockets/ws#readme",
  "keywords": [
    "Hixie",
    "HyBi",
    "Push",
    "RFC-6455",
    "WebSocket",
    "WebSockets",
    "real-time"
  ],
  "license": "MIT",
  "main": "index.js",
  "name": "ws",
  "optionalDependencies": {},
  "readme": "# ws: a node.js websocket library\n\n[![Build Status](https://travis-ci.org/websockets/ws.svg?branch=master)](https://travis-ci.org/websockets/ws)\n\n`ws` is a simple to use WebSocket implementation, up-to-date against RFC-6455,\nand [probably the fastest WebSocket library for node.js][archive].\n\nPasses the quite extensive Autobahn test suite. See http://websockets.github.com/ws\nfor the full reports.\n\n## Protocol support\n\n* **Hixie draft 76** (Old and deprecated, but still in use by Safari and Opera.\n  Added to ws version 0.4.2, but server only. Can be disabled by setting the\n  `disableHixie` option to true.)\n* **HyBi drafts 07-12** (Use the option `protocolVersion: 8`)\n* **HyBi drafts 13-17** (Current default, alternatively option `protocolVersion: 13`)\n\n### Installing\n\n```\nnpm install --save ws\n```\n\n### Opt-in for performance\n\nThere are 2 optional modules that can be installed along side with the `ws`\nmodule. These modules are binary addons which improve certain operations, but as\nthey are binary addons they require compilation which can fail if no c++\ncompiler is installed on the host system.\n\n- `npm install --save bufferutil`: Improves internal buffer operations which\n  allows for faster processing of masked WebSocket frames and general buffer\n  operations.\n- `npm install --save utf-8-validate`: The specification requires validation of\n  invalid UTF-8 chars, some of these validations could not be done in JavaScript\n  hence the need for a binary addon. In most cases you will already be\n  validating the input that you receive for security purposes leading to double\n  validation. But if you want to be 100% spec-conforming and have fast\n  validation of UTF-8 then this module is a must.\n\n### Sending and receiving text data\n\n```js\nvar WebSocket = require('ws');\nvar ws = new WebSocket('ws://www.host.com/path');\n\nws.on('open', function open() {\n  ws.send('something');\n});\n\nws.on('message', function(data, flags) {\n  // flags.binary will be set if a binary data is received.\n  // flags.masked will be set if the data was masked.\n});\n```\n\n### Sending binary data\n\n```js\nvar WebSocket = require('ws');\nvar ws = new WebSocket('ws://www.host.com/path');\n\nws.on('open', function open() {\n  var array = new Float32Array(5);\n\n  for (var i = 0; i < array.length; ++i) {\n    array[i] = i / 2;\n  }\n\n  ws.send(array, { binary: true, mask: true });\n});\n```\n\nSetting `mask`, as done for the send options above, will cause the data to be\nmasked according to the WebSocket protocol. The same option applies for text\ndata.\n\n### Server example\n\n```js\nvar WebSocketServer = require('ws').Server\n  , wss = new WebSocketServer({ port: 8080 });\n\nwss.on('connection', function connection(ws) {\n  ws.on('message', function incoming(message) {\n    console.log('received: %s', message);\n  });\n\n  ws.send('something');\n});\n```\n\n### ExpressJS example\n\n```js\nvar server = require('http').createServer()\n  , url = require('url')\n  , WebSocketServer = require('ws').Server\n  , wss = new WebSocketServer({ server: server })\n  , express = require('express')\n  , app = express()\n  , port = 4080;\n\napp.use(function (req, res) {\n  res.send({ msg: \"hello\" });\n});\n\nwss.on('connection', function connection(ws) {\n  var location = url.parse(ws.upgradeReq.url, true);\n  // you might use location.query.access_token to authenticate or share sessions\n  // or ws.upgradeReq.headers.cookie (see http://stackoverflow.com/a/16395220/151312)\n\n  ws.on('message', function incoming(message) {\n    console.log('received: %s', message);\n  });\n\n  ws.send('something');\n});\n\nserver.on('request', app);\nserver.listen(port, function () { console.log('Listening on ' + server.address().port) });\n```\n\n### Server sending broadcast data\n\n```js\nvar WebSocketServer = require('ws').Server\n  , wss = new WebSocketServer({ port: 8080 });\n\nwss.broadcast = function broadcast(data) {\n  wss.clients.forEach(function each(client) {\n    client.send(data);\n  });\n};\n```\n\n### Error handling best practices\n\n```js\n// If the WebSocket is closed before the following send is attempted\nws.send('something');\n\n// Errors (both immediate and async write errors) can be detected in an optional\n// callback. The callback is also the only way of being notified that data has\n// actually been sent.\nws.send('something', function ack(error) {\n  // if error is not defined, the send has been completed,\n  // otherwise the error object will indicate what failed.\n});\n\n// Immediate errors can also be handled with try/catch-blocks, but **note** that\n// since sends are inherently asynchronous, socket write failures will *not* be\n// captured when this technique is used.\ntry { ws.send('something'); }\ncatch (e) { /* handle error */ }\n```\n\n### echo.websocket.org demo\n\n```js\nvar WebSocket = require('ws');\nvar ws = new WebSocket('ws://echo.websocket.org/', {\n  protocolVersion: 8,\n  origin: 'http://websocket.org'\n});\n\nws.on('open', function open() {\n  console.log('connected');\n  ws.send(Date.now().toString(), {mask: true});\n});\n\nws.on('close', function close() {\n  console.log('disconnected');\n});\n\nws.on('message', function message(data, flags) {\n  console.log('Roundtrip time: ' + (Date.now() - parseInt(data)) + 'ms', flags);\n\n  setTimeout(function timeout() {\n    ws.send(Date.now().toString(), {mask: true});\n  }, 500);\n});\n```\n\n### Other examples\n\nFor a full example with a browser client communicating with a ws server, see the\nexamples folder.\n\nNote that the usage together with Express 3.0 is quite different from Express\n2.x. The difference is expressed in the two different serverstats-examples.\n\nOtherwise, see the test cases.\n\n### Running the tests\n\n```\nmake test\n```\n\n## API Docs\n\nSee [`/doc/ws.md`](https://github.com/websockets/ws/blob/master/doc/ws.md) for Node.js-like docs for the ws classes.\n\n## Changelog\n\nWe're using the GitHub [`releases`](https://github.com/websockets/ws/releases) for changelog entries.\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2011 Einar Otto Stangvik &lt;einaros@gmail.com&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n[archive]: http://web.archive.org/web/20130314230536/http://hobbycoding.posterous.com/the-fastest-websocket-module-for-nodejs\n",
  "readmeFilename": "README.md",
  "repository": {
    "type": "git",
    "url": "git://github.com/websockets/ws.git"
  },
  "scripts": {
    "test": "make test"
  },
  "version": "1.1.1"
}
