{
  "name": "engine.io-client",
  "description": "Client for the realtime Engine",
  "version": "1.4.0",
  "homepage": "http://socket.io",
  "contributors": [
    {
      "name": "Guillermo Rauch",
      "email": "rauchg@gmail.com"
    },
    {
      "name": "Vladimir Dronnikov",
      "email": "dronnikov@gmail.com"
    },
    {
      "name": "Christoph Dorn",
      "url": "https://github.com/cadorn"
    },
    {
      "name": "Mark Mokryn",
      "email": "mokesmokes@gmail.com"
    }
  ],
  "dependencies": {
    "has-cors": "1.0.3",
    "ws": "0.4.31",
    "xmlhttprequest": "https://github.com/LearnBoost/node-XMLHttpRequest/archive/0f36d0b5ebc03d85f860d42a64ae9791e1daa433.tar.gz",
    "component-emitter": "1.1.2",
    "indexof": "0.0.1",
    "engine.io-parser": "1.1.0",
    "debug": "0.7.4",
    "parseuri": "0.0.4",
    "parsejson": "0.0.1",
    "parseqs": "0.0.2",
    "component-inherit": "0.0.3"
  },
  "devDependencies": {
    "zuul": "1.10.2",
    "mocha": "1.16.2",
    "expect.js": "0.2.0",
    "istanbul": "0.2.3",
    "browserify": "4.2.1",
    "engine.io": "1.4.0",
    "express": "3.4.8",
    "blob": "0.0.2"
  },
  "scripts": {
    "test": "make test"
  },
  "browser": {
    "xmlhttprequest": "./lib/xmlhttprequest.js"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/Automattic/engine.io-client.git"
  },
  "readme": "\n# Engine.IO client\n\n[![Build Status](https://secure.travis-ci.org/Automattic/engine.io-client.png)](http://travis-ci.org/Automattic/engine.io-client)\n[![NPM version](https://badge.fury.io/js/engine.io-client.png)](http://badge.fury.io/js/engine.io-client)\n\nThis is the client for [Engine.IO](http://github.com/automattic/engine.io),\nthe implementation of transport-based cross-browser/cross-device\nbi-directional communication layer for [Socket.IO](http://github.com/automattic/socket.io).\n\n## How to use\n\n### Standalone\n\nYou can find an `engine.io.js` file in this repository, which is a\nstandalone build you can use as follows:\n\n```html\n<script src=\"/path/to/engine.io.js\"></script>\n<script>\n  // eio = Socket\n  var socket = eio('ws://localhost');\n  socket.on('open', function(){\n    socket.on('message', function(data){});\n    socket.on('close', function(){});\n  });\n</script>\n```\n\n### With browserify\n\nEngine.IO is a commonjs module, which means you can include it by using\n`require` on the browser and package using [browserify](http://browserify.org/):\n\n1. install the client package\n\n    ```bash\n    $ npm install engine.io-client\n    ```\n\n1. write your app code\n\n    ```js\n    var socket = require('engine.io-client')('ws://localhost');\n    socket.on('open', function(){\n      socket.on('message', function(data){});\n      socket.on('close', function(){});\n    });\n    ```\n\n1. build your app bundle\n\n    ```bash\n    $ browserify app.js > bundle.js\n    ```\n\n1. include on your page\n\n    ```html\n    <script src=\"/path/to/bundle.js\"></script>\n    ```\n\n### Sending and receiving binary\n\n```html\n<script src=\"/path/to/engine.io.js\"></script>\n<script>\n  var socket = new eio.Socket('ws://localhost/');\n  socket.binaryType = 'blob';\n  socket.on('open', function () {\n    socket.send(new Int8Array(5));\n    socket.on('message', function(blob){});\n    socket.on('close', function(){ });\n  });\n</script>\n```\n\n### Node.JS\n\nAdd `engine.io-client` to your `package.json` and then:\n\n```js\nvar socket = require('engine.io-client')('ws://localhost');\nsocket.on('open', function(){\n  socket.on('message', function(data){});\n  socket.on('close', function(){});\n});\n```\n\n## Features\n\n- Lightweight\n- Runs on browser and node.js seamlessly\n- Transports are independent of `Engine`\n  - Easy to debug\n  - Easy to unit test\n- Runs inside HTML5 WebWorker\n- Can send and receive binary data\n  - Receives as ArrayBuffer or Blob when in browser, and Buffer or ArrayBuffer\n    in Node\n  - When XHR2 or WebSockets are used, binary is emitted directly. Otherwise\n    binary is encoded into base64 strings, and decoded when binary types are\n    supported.\n  - With browsers that don't support ArrayBuffer, an object { base64: true,\n    data: dataAsBase64String } is emitted on the `message` event.\n\n## API\n\n### Socket\n\nThe client class. Mixes in [Emitter](http://github.com/component/emitter).\nExposed as `eio` in the browser standalone build.\n\n#### Properties\n\n- `protocol` _(Number)_: protocol revision number\n- `binaryType` _(String)_ : can be set to 'arraybuffer' or 'blob' in browsers,\n  and `buffer` or `arraybuffer` in Node. Blob is only used in browser if it's\n  supported.\n\n#### Events\n\n- `open`\n  - Fired upon successful connection.\n- `message`\n  - Fired when data is received from the server.\n  - **Arguments**\n    - `String` | `ArrayBuffer`: utf-8 encoded data or ArrayBuffer containing\n      binary data\n- `close`\n  - Fired upon disconnection. In compliance with the WebSocket API spec, this event may be \n    fired even if the `open` event does not occur (i.e. due to connection error or `close()`).\n- `error`\n  - Fired when an error occurs.\n- `flush`\n  - Fired upon completing a buffer flush\n- `drain`\n  - Fired after `drain` event of transport if writeBuffer is empty\n- `upgradeError`\n  - Fired if an error occurs with a transport we're trying to upgrade to.\n- `upgrade`\n  - Fired upon upgrade success, after the new transport is set\n\n#### Methods\n\n- **constructor**\n    - Initializes the client\n    - **Parameters**\n      - `String` uri\n      - `Object`: optional, options object\n    - **Options**\n      - `agent` (`http.Agent`): `http.Agent` to use, defaults to `false` (NodeJS only)\n      - `upgrade` (`Boolean`): defaults to true, whether the client should try\n      to upgrade the transport from long-polling to something better.\n      - `forceJSONP` (`Boolean`): forces JSONP for polling transport.\n      - `jsonp` (`Boolean`): determines whether to use JSONP when\n        necessary for polling. If disabled (by settings to false) an error will\n        be emitted (saying \"No transports available\") if no other transports\n        are available. If another transport is available for opening a\n        connection (e.g. WebSocket) that transport\n        will be used instead.\n      - `forceBase64` (`Boolean`): forces base 64 encoding for polling transport even when XHR2 responseType is available and WebSocket even if the used standard supports binary.\n      - `enablesXDR` (`Boolean`): enables XDomainRequest for IE8 to avoid loading bar flashing with click sound. default to `false` because XDomainRequest has a flaw of not sending cookie.\n      - `timestampRequests` (`Boolean`): whether to add the timestamp with\n        each transport request. Note: this is ignored if the browser is\n        IE or Android, in which case requests are always stamped (`false`)\n      - `timestampParam` (`String`): timestamp parameter (`t`)\n      - `policyPort` (`Number`): port the policy server listens on (`843`)\n      - `path` (`String`): path to connect to, default is `/engine.io`\n      - `transports` (`Array`): a list of transports to try (in order).\n      Defaults to `['polling', 'websocket']`. `Engine`\n      always attempts to connect directly with the first one, provided the\n      feature detection test for it passes.\n      - `rememberUpgrade` (`Boolean`): defaults to false.\n        If true and if the previous websocket connection to the server succeeded,\n        the connection attempt will bypass the normal upgrade process and will initially\n        try websocket. A connection attempt following a transport error will use the \n        normal upgrade process. It is recommended you turn this on only when using\n        SSL/TLS connections, or if you know that your network does not block websockets.\n- `send`\n    - Sends a message to the server\n    - **Parameters**\n      - `String` | `ArrayBuffer` | `ArrayBufferView` | `Blob`: data to send\n      - `Function`: optional, callback upon `drain`\n- `close`\n    - Disconnects the client.\n\n### Transport\n\nThe transport class. Private. _Inherits from EventEmitter_.\n\n#### Events\n\n- `poll`: emitted by polling transports upon starting a new request\n- `pollComplete`: emitted by polling transports upon completing a request\n- `drain`: emitted by polling transports upon a buffer drain\n\n## Tests\n\n`engine.io-client` is used to test\n[engine](http://github.com/automattic/engine.io). Running the `engine.io`\ntest suite ensures the client works and vice-versa.\n\nBrowser tests are run using [zuul](https://github.com/defunctzombie/zuul). You can\nrun the tests locally using the following command.\n\n```\n./node_modules/.bin/zuul --local 8080 -- test/index.js\n```\n\nAdditionally, `engine.io-client` has a standalone test suite you can run\nwith `make test` which will run node.js and browser tests. You must have zuul setup with\na saucelabs account.\n\n## Support\n\nThe support channels for `engine.io-client` are the same as `socket.io`:\n  - irc.freenode.net **#socket.io**\n  - [Google Groups](http://groups.google.com/group/socket_io)\n  - [Website](http://socket.io)\n\n## Development\n\nTo contribute patches, run tests or benchmarks, make sure to clone the\nrepository:\n\n```bash\ngit clone git://github.com/automattic/engine.io-client.git\n```\n\nThen:\n\n```bash\ncd engine.io-client\nnpm install\n```\n\nSee the `Tests` section above for how to run tests before submitting any patches.\n\n## License\n\nMIT - Copyright (c) 2014 Automattic, Inc.\n\n",
  "readmeFilename": "README.md",
  "bugs": {
    "url": "https://github.com/Automattic/engine.io-client/issues"
  },
  "_id": "engine.io-client@1.4.0",
  "dist": {
    "shasum": "f0f05482ca707639bb1999541e00fb2725cb43ca"
  },
  "_from": "engine.io-client@1.4.0",
  "_resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-1.4.0.tgz"
}
