{
  "_args": [
    [
      {
        "raw": "faye-websocket@https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.9.3.tgz",
        "scope": null,
        "escapedName": "faye-websocket",
        "name": "faye-websocket",
        "rawSpec": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.9.3.tgz",
        "spec": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.9.3.tgz",
        "type": "remote"
      },
      "E:\\MissionXJC\\XJC\\functions\\node_modules\\firebase-admin"
    ]
  ],
  "_from": "faye-websocket@0.9.3",
  "_id": "faye-websocket@0.9.3",
  "_inCache": true,
  "_location": "/firebase-admin/faye-websocket",
  "_phantomChildren": {},
  "_requested": {
    "raw": "faye-websocket@https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.9.3.tgz",
    "scope": null,
    "escapedName": "faye-websocket",
    "name": "faye-websocket",
    "rawSpec": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.9.3.tgz",
    "spec": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.9.3.tgz",
    "type": "remote"
  },
  "_requiredBy": [
    "/firebase-admin"
  ],
  "_resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.9.3.tgz",
  "_shasum": "482a505b0df0ae626b969866d3bd740cdb962e83",
  "_shrinkwrap": null,
  "_spec": "faye-websocket@https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.9.3.tgz",
  "_where": "E:\\MissionXJC\\XJC\\functions\\node_modules\\firebase-admin",
  "author": {
    "name": "James Coglan",
    "email": "jcoglan@gmail.com",
    "url": "http://jcoglan.com/"
  },
  "bugs": {
    "url": "http://github.com/faye/faye-websocket-node/issues"
  },
  "dependencies": {
    "websocket-driver": ">=0.5.1"
  },
  "description": "Standards-compliant WebSocket server and client",
  "devDependencies": {
    "jstest": "",
    "pace": "",
    "permessage-deflate": ""
  },
  "engines": {
    "node": ">=0.4.0"
  },
  "homepage": "http://github.com/faye/faye-websocket-node",
  "keywords": [
    "websocket",
    "eventsource"
  ],
  "license": "MIT",
  "main": "./lib/faye/websocket",
  "name": "faye-websocket",
  "optionalDependencies": {},
  "readme": "# faye-websocket\n\n* Travis CI build: [![Build\n  status](https://secure.travis-ci.org/faye/faye-websocket-node.svg)](http://travis-ci.org/faye/faye-websocket-node)\n* Autobahn tests: [server](http://faye.jcoglan.com/autobahn/servers/),\n  [client](http://faye.jcoglan.com/autobahn/clients/)\n\nThis is a general-purpose WebSocket implementation extracted from the\n[Faye](http://faye.jcoglan.com) project. It provides classes for easily building\nWebSocket servers and clients in Node. It does not provide a server itself, but\nrather makes it easy to handle WebSocket connections within an existing\n[Node](http://nodejs.org/) application. It does not provide any abstraction\nother than the standard [WebSocket API](http://dev.w3.org/html5/websockets/).\n\nIt also provides an abstraction for handling\n[EventSource](http://dev.w3.org/html5/eventsource/) connections, which are\none-way connections that allow the server to push data to the client. They are\nbased on streaming HTTP responses and can be easier to access via proxies than\nWebSockets.\n\n\n## Installation\n\n```\n$ npm install faye-websocket\n```\n\n\n## Handling WebSocket connections in Node\n\nYou can handle WebSockets on the server side by listening for HTTP Upgrade\nrequests, and creating a new socket for the request. This socket object exposes\nthe usual WebSocket methods for receiving and sending messages. For example this\nis how you'd implement an echo server:\n\n```js\nvar WebSocket = require('faye-websocket'),\n    http      = require('http');\n\nvar server = http.createServer();\n\nserver.on('upgrade', function(request, socket, body) {\n  if (WebSocket.isWebSocket(request)) {\n    var ws = new WebSocket(request, socket, body);\n    \n    ws.on('message', function(event) {\n      ws.send(event.data);\n    });\n    \n    ws.on('close', function(event) {\n      console.log('close', event.code, event.reason);\n      ws = null;\n    });\n  }\n});\n\nserver.listen(8000);\n```\n\n`WebSocket` objects are also duplex streams, so you could replace the\n`ws.on('message', ...)` line with:\n\n```js\n    ws.pipe(ws);\n```\n\nNote that under certain circumstances (notably a draft-76 client connecting\nthrough an HTTP proxy), the WebSocket handshake will not be complete after you\ncall `new WebSocket()` because the server will not have received the entire\nhandshake from the client yet. In this case, calls to `ws.send()` will buffer\nthe message in memory until the handshake is complete, at which point any\nbuffered messages will be sent to the client.\n\nIf you need to detect when the WebSocket handshake is complete, you can use the\n`onopen` event.\n\nIf the connection's protocol version supports it, you can call `ws.ping()` to\nsend a ping message and wait for the client's response. This method takes a\nmessage string, and an optional callback that fires when a matching pong message\nis received. It returns `true` iff a ping message was sent. If the client does\nnot support ping/pong, this method sends no data and returns `false`.\n\n```js\nws.ping('Mic check, one, two', function() {\n  // fires when pong is received\n});\n```\n\n\n## Using the WebSocket client\n\nThe client supports both the plain-text `ws` protocol and the encrypted `wss`\nprotocol, and has exactly the same interface as a socket you would use in a web\nbrowser. On the wire it identifies itself as `hybi-13`.\n\n```js\nvar WebSocket = require('faye-websocket'),\n    ws        = new WebSocket.Client('ws://www.example.com/');\n\nws.on('open', function(event) {\n  console.log('open');\n  ws.send('Hello, world!');\n});\n\nws.on('message', function(event) {\n  console.log('message', event.data);\n});\n\nws.on('close', function(event) {\n  console.log('close', event.code, event.reason);\n  ws = null;\n});\n```\n\nThe WebSocket client also lets you inspect the status and headers of the\nhandshake response via its `statusCode` and `headers` properties.\n\nTo connect via a proxy, set the `proxy` option to the HTTP origin of the proxy,\nincluding any authorization information, custom headers and TLS config you\nrequire. Only the `origin` setting is required.\n\n```js\nvar ws = new WebSocket.Client('ws://www.example.com/', null, {\n  proxy: {\n    origin:  'http://username:password@proxy.example.com',\n    headers: {'User-Agent': 'node'},\n    tls:     {cert: fs.readFileSync('client.crt')}\n  }\n});\n```\n\nThe `tls` value is a Node 'TLS options' object that will be passed to\n[`tls.connect()`](http://nodejs.org/api/tls.html#tls_tls_connect_options_callback).\n\n\n## Subprotocol negotiation\n\nThe WebSocket protocol allows peers to select and identify the application\nprotocol to use over the connection. On the client side, you can set which\nprotocols the client accepts by passing a list of protocol names when you\nconstruct the socket:\n\n```js\nvar ws = new WebSocket.Client('ws://www.example.com/', ['irc', 'amqp']);\n```\n\nOn the server side, you can likewise pass in the list of protocols the server\nsupports after the other constructor arguments:\n\n```js\nvar ws = new WebSocket(request, socket, body, ['irc', 'amqp']);\n```\n\nIf the client and server agree on a protocol, both the client- and server-side\nsocket objects expose the selected protocol through the `ws.protocol` property.\n\n\n## Protocol extensions\n\nfaye-websocket is based on the\n[websocket-extensions](https://github.com/faye/websocket-extensions-node)\nframework that allows extensions to be negotiated via the\n`Sec-WebSocket-Extensions` header. To add extensions to a connection, pass an\narray of extensions to the `:extensions` option. For example, to add\n[permessage-deflate](https://github.com/faye/permessage-deflate-node):\n\n```js\nvar deflate = require('permessage-deflate');\n\nvar ws = new WebSocket(request, socket, body, null, {extensions: [deflate]});\n```\n\n\n## Initialization options\n\nBoth the server- and client-side classes allow an options object to be passed in\nat initialization time, for example:\n\n```js\nvar ws = new WebSocket(request, socket, body, protocols, options);\nvar ws = new WebSocket.Client(url, protocols, options);\n```\n\n`protocols` is an array of subprotocols as described above, or `null`.\n`options` is an optional object containing any of these fields:\n\n* `extensions` - an array of\n  [websocket-extensions](https://github.com/faye/websocket-extensions-node)\n  compatible extensions, as described above\n* `headers` - an object containing key-value pairs representing HTTP headers to\n  be sent during the handshake process\n* `maxLength` - the maximum allowed size of incoming message frames, in bytes.\n  The default value is `2^26 - 1`, or 1 byte short of 64 MiB.\n* `ping` - an integer that sets how often the WebSocket should send ping frames,\n  measured in seconds\n\nThe client accepts some additional options:\n\n* `proxy` - settings for a proxy as described above\n* `tls` - a Node 'TLS options' object containing TLS settings for the origin\n  server, this will be passed to\n  [`tls.connect()`](http://nodejs.org/api/tls.html#tls_tls_connect_options_callback)\n* `ca` - (legacy) a shorthand for passing `{tls: {ca: value}}`\n\n\n## WebSocket API\n\nBoth server- and client-side `WebSocket` objects support the following API.\n\n* <b>`on('open', function(event) {})`</b> fires when the socket connection is\n  established. Event has no attributes.\n* <b>`on('message', function(event) {})`</b> fires when the socket receives a\n  message. Event has one attribute, <b>`data`</b>, which is either a `String`\n  (for text frames) or a `Buffer` (for binary frames).\n* <b>`on('error', function(event) {})`</b> fires when there is a protocol error\n  due to bad data sent by the other peer. This event is purely informational,\n  you do not need to implement error recover.\n* <b>`on('close', function(event) {})`</b> fires when either the client or the\n  server closes the connection. Event has two optional attributes, <b>`code`</b>\n  and <b>`reason`</b>, that expose the status code and message sent by the peer\n  that closed the connection.\n* <b>`send(message)`</b> accepts either a `String` or a `Buffer` and sends a\n  text or binary message over the connection to the other peer.\n* <b>`ping(message = '', function() {})`</b> sends a ping frame with an optional\n  message and fires the callback when a matching pong is received.\n* <b>`close(code, reason)`</b> closes the connection, sending the given status\n  code and reason text, both of which are optional.\n* <b>`version`</b> is a string containing the version of the `WebSocket`\n  protocol the connection is using.\n* <b>`protocol`</b> is a string (which may be empty) identifying the subprotocol\n  the socket is using.\n\n\n## Handling EventSource connections in Node\n\nEventSource connections provide a very similar interface, although because they\nonly allow the server to send data to the client, there is no `onmessage` API.\nEventSource allows the server to push text messages to the client, where each\nmessage has an optional event-type and ID.\n\n```js\nvar WebSocket   = require('faye-websocket'),\n    EventSource = WebSocket.EventSource,\n    http        = require('http');\n\nvar server = http.createServer();\n\nserver.on('request', function(request, response) {\n  if (EventSource.isEventSource(request)) {\n    var es = new EventSource(request, response);\n    console.log('open', es.url, es.lastEventId);\n    \n    // Periodically send messages\n    var loop = setInterval(function() { es.send('Hello') }, 1000);\n    \n    es.on('close', function() {\n      clearInterval(loop);\n      es = null;\n    });\n  \n  } else {\n    // Normal HTTP request\n    response.writeHead(200, {'Content-Type': 'text/plain'});\n    response.end('Hello');\n  }\n});\n\nserver.listen(8000);\n```\n\nThe `send` method takes two optional parameters, `event` and `id`. The default\nevent-type is `'message'` with no ID. For example, to send a `notification`\nevent with ID `99`:\n\n```js\nes.send('Breaking News!', {event: 'notification', id: '99'});\n```\n\nThe `EventSource` object exposes the following properties:\n\n* <b>`url`</b> is a string containing the URL the client used to create the\n  EventSource.\n* <b>`lastEventId`</b> is a string containing the last event ID received by the\n  client. You can use this when the client reconnects after a dropped connection\n  to determine which messages need resending.\n\nWhen you initialize an EventSource with ` new EventSource()`, you can pass\nconfiguration options after the `response` parameter. Available options are:\n\n* <b>`headers`</b> is an object containing custom headers to be set on the\n  EventSource response.\n* <b>`retry`</b> is a number that tells the client how long (in seconds) it\n  should wait after a dropped connection before attempting to reconnect.\n* <b>`ping`</b> is a number that tells the server how often (in seconds) to send\n  'ping' packets to the client to keep the connection open, to defeat timeouts\n  set by proxies. The client will ignore these messages.\n\nFor example, this creates a connection that allows access from any origin, pings\nevery 15 seconds and is retryable every 10 seconds if the connection is broken:\n\n```js\nvar es = new EventSource(request, response, {\n  headers: {'Access-Control-Allow-Origin': '*'},\n  ping:    15,\n  retry:   10\n});\n```\n\nYou can send a ping message at any time by calling `es.ping()`. Unlike\nWebSocket, the client does not send a response to this; it is merely to send\nsome data over the wire to keep the connection alive.\n\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2010-2015 James Coglan\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the 'Software'), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n",
  "readmeFilename": "README.md",
  "repository": {
    "type": "git",
    "url": "git://github.com/faye/faye-websocket-node.git"
  },
  "scripts": {
    "test": "jstest spec/runner.js"
  },
  "version": "0.9.3"
}
