{"_id":"websocket.io","_rev":"123726","name":"websocket.io","description":"Socket.IO websocket server","dist-tags":{"latest":"0.2.1"},"maintainers":[{"name":"rauchg","email":""}],"time":{"modified":"2021-06-03T10:59:21.000Z","created":"2011-11-27T21:28:48.305Z","0.2.1":"2012-07-03T19:42:06.697Z","0.2.0":"2012-06-19T21:37:01.729Z","0.1.6":"2012-02-27T13:32:49.103Z","0.1.5":"2012-02-10T14:03:16.117Z","0.1.4":"2012-01-05T01:51:15.270Z","0.1.2":"2011-12-12T22:10:44.524Z","0.1.1":"2011-11-27T21:28:48.305Z"},"users":{"mhaidarh":true,"aigninja":true,"devnka":true},"versions":{"0.2.1":{"name":"websocket.io","description":"Socket.IO websocket server","version":"0.2.1","contributors":[{"name":"Guillermo Rauch","email":"rauchg@gmail.com"},{"name":"Einar Otto Stangvik","email":"einaros@gmail.com"},{"name":"Arnout Kazemier","email":"info@3rd-eden.com"},{"name":"Nico Kaiser","email":"nico@kaiser.me"},{"name":"Andor Goetzendorff","email":"andor.g@mytum.de"}],"dependencies":{"debug":"*","ws":"0.4.20"},"devDependencies":{"mocha":"*","should":"*","colors":"*","benchmark":"0.2.2"},"main":"lib/websocket.io","engines":{"node":">=0.4.0"},"scripts":{"test":"make test"},"_npmUser":{"name":"rauchg","email":"rauchg@gmail.com"},"_id":"websocket.io@0.2.1","optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.24","_nodeVersion":"v0.8.0","_defaultsLoaded":true,"dist":{"shasum":"79eaf174b91ecfa4fbf14ffe268871c052e47d2a","size":10110,"noattachment":false,"key":"/websocket.io/-/websocket.io-0.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/websocket.io/download/websocket.io-0.2.1.tgz"},"maintainers":[{"name":"rauchg","email":""}],"directories":{},"publish_time":1341344526697,"_hasShrinkwrap":false,"_cnpm_publish_time":1341344526697},"0.2.0":{"name":"websocket.io","description":"Socket.IO websocket server","version":"0.2.0","contributors":[{"name":"Guillermo Rauch","email":"rauchg@gmail.com"},{"name":"Einar Otto Stangvik","email":"einaros@gmail.com"},{"name":"Arnout Kazemier","email":"info@3rd-eden.com"},{"name":"Nico Kaiser","email":"nico@kaiser.me"}],"dependencies":{"debug":"*","ws":"0.4.18"},"devDependencies":{"mocha":"*","should":"*","colors":"*","benchmark":"0.2.2"},"main":"lib/websocket.io","engines":{"node":">=0.4.0"},"scripts":{"test":"make test"},"_npmUser":{"name":"rauchg","email":"rauchg@gmail.com"},"_id":"websocket.io@0.2.0","optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.24","_nodeVersion":"v0.6.18","_defaultsLoaded":true,"dist":{"shasum":"52925f0dbcff39e3a86d7583e768fabbc0af91cd","size":9904,"noattachment":false,"key":"/websocket.io/-/websocket.io-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/websocket.io/download/websocket.io-0.2.0.tgz"},"maintainers":[{"name":"rauchg","email":""}],"directories":{},"publish_time":1340141821729,"_hasShrinkwrap":false,"_cnpm_publish_time":1340141821729},"0.1.6":{"name":"websocket.io","description":"Socket.IO websocket server","version":"0.1.6","contributors":[{"name":"Guillermo Rauch","email":"rauchg@gmail.com"},{"name":"Einar Otto Stangvik","email":"einaros@gmail.com"},{"name":"Arnout Kazemier","email":"info@3rd-eden.com"}],"dependencies":{"ws":"0.4.x"},"devDependencies":{"mocha":"*","should":"*","colors":"*","benchmark":"0.2.2"},"main":"lib/websocket.io","engines":{"node":">=0.4.0"},"scripts":{"test":"make test"},"_npmUser":{"name":"rauchg","email":"rauchg@gmail.com"},"_id":"websocket.io@0.1.6","_engineSupported":true,"_npmVersion":"1.0.106","_nodeVersion":"v0.4.12","_defaultsLoaded":true,"dist":{"shasum":"50e0e47e73548ad07392f5f3482152bc82cf9a5e","size":20480,"noattachment":false,"key":"/websocket.io/-/websocket.io-0.1.6.tgz","tarball":"http://registry.cnpm.dingdandao.com/websocket.io/download/websocket.io-0.1.6.tgz"},"maintainers":[{"name":"rauchg","email":""}],"directories":{},"publish_time":1330349569103,"_hasShrinkwrap":false,"_cnpm_publish_time":1330349569103},"0.1.5":{"name":"websocket.io","description":"Socket.IO websocket server","version":"0.1.5","contributors":[{"name":"Guillermo Rauch","email":"rauchg@gmail.com"},{"name":"Einar Otto Stangvik","email":"einaros@gmail.com"},{"name":"Arnout Kazemier","email":"info@3rd-eden.com"}],"dependencies":{"ws":"0.4.x"},"devDependencies":{"mocha":"*","should":"*","colors":"*","benchmark":"0.2.2"},"main":"lib/websocket.io","engines":{"node":">=0.4.0"},"scripts":{"test":"make test"},"_npmUser":{"name":"rauchg","email":"rauchg@gmail.com"},"_id":"websocket.io@0.1.5","optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.0-3","_nodeVersion":"v0.6.10","_defaultsLoaded":true,"dist":{"shasum":"38f9c06fdb0b5ac345732841c337b32ac8a990dc","size":12583,"noattachment":false,"key":"/websocket.io/-/websocket.io-0.1.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/websocket.io/download/websocket.io-0.1.5.tgz"},"maintainers":[{"name":"rauchg","email":""}],"directories":{},"publish_time":1328882596117,"_hasShrinkwrap":false,"_cnpm_publish_time":1328882596117},"0.1.4":{"name":"websocket.io","description":"Socket.IO websocket server","version":"0.1.4","contributors":[{"name":"Guillermo Rauch","email":"rauchg@gmail.com"},{"name":"Einar Otto Stangvik","email":"einaros@gmail.com"},{"name":"Arnout Kazemier","email":"info@3rd-eden.com"}],"dependencies":{"ws":"0.4.0"},"devDependencies":{"mocha":"*","should":"*","colors":"*","benchmark":"0.2.2"},"main":"lib/websocket.io","engines":{"node":">=0.4.0"},"scripts":{"test":"make test"},"_npmUser":{"name":"rauchg","email":"rauchg@gmail.com"},"_id":"websocket.io@0.1.4","_engineSupported":true,"_npmVersion":"1.0.106","_nodeVersion":"v0.4.12","_defaultsLoaded":true,"dist":{"shasum":"205202608619673171a25d1b02faac21e642f9c4","size":20480,"noattachment":false,"key":"/websocket.io/-/websocket.io-0.1.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/websocket.io/download/websocket.io-0.1.4.tgz"},"maintainers":[{"name":"rauchg","email":""}],"directories":{},"publish_time":1325728275270,"_hasShrinkwrap":false,"_cnpm_publish_time":1325728275270},"0.1.2":{"name":"websocket.io","description":"Socket.IO websocket server","version":"0.1.2","contributors":[{"name":"Guillermo Rauch","email":"rauchg@gmail.com"},{"name":"Einar Otto Stangvik","email":"einaros@gmail.com"},{"name":"Arnout Kazemier","email":"info@3rd-eden.com"}],"dependencies":{"ws":"0.3.1"},"devDependencies":{"mocha":"*","should":"0.3.2","colors":"*","benchmark":"0.2.2"},"main":"lib/websocket.io","engines":{"node":">=0.4.0"},"scripts":{"test":"make test"},"_npmUser":{"name":"rauchg","email":"rauchg@gmail.com"},"_id":"websocket.io@0.1.2","_engineSupported":true,"_npmVersion":"1.0.106","_nodeVersion":"v0.4.12","_defaultsLoaded":true,"dist":{"shasum":"1249de393fb4f265cd4785981ce6cb8755da826f","size":20480,"noattachment":false,"key":"/websocket.io/-/websocket.io-0.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/websocket.io/download/websocket.io-0.1.2.tgz"},"maintainers":[{"name":"rauchg","email":""}],"directories":{},"publish_time":1323727844524,"_hasShrinkwrap":false,"_cnpm_publish_time":1323727844524},"0.1.1":{"name":"websocket.io","description":"Socket.IO websocket server","version":"0.1.1","contributors":[{"name":"Guillermo Rauch","email":"rauchg@gmail.com"},{"name":"Einar Otto Stangvik","email":"einaros@gmail.com"},{"name":"Arnout Kazemier","email":"info@3rd-eden.com"}],"dependencies":{"easy-websocket":"0.2.0"},"devDependencies":{"mocha":"*","should":"0.3.2","colors":"*","benchmark":"0.2.2"},"main":"lib/websocket.io","engines":{"node":">= 0.5.0 < 0.7.0"},"scripts":{"test":"make test"},"_npmUser":{"name":"rauchg","email":"rauchg@gmail.com"},"_id":"websocket.io@0.1.1","_engineSupported":true,"_npmVersion":"1.0.106","_nodeVersion":"v0.6.2","_defaultsLoaded":true,"dist":{"shasum":"148e285b0da1c07ab24bbbff0bc6c0af0ce5eeef","size":20480,"noattachment":false,"key":"/websocket.io/-/websocket.io-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/websocket.io/download/websocket.io-0.1.1.tgz"},"maintainers":[{"name":"rauchg","email":""}],"directories":{},"publish_time":1322429328305,"_hasShrinkwrap":false,"_cnpm_publish_time":1322429328305}},"readme":"WebSocket.IO\n============\n\nWebSocket.IO is an abstraction of the websocket server previously used by Socket.IO.\nIt has the broadest support for websocket protocol/specifications and an API that\nallows for interoperability with higher-level frameworks such as\n[Engine](http://github.com/learnboost/engine.io),\n[Socket.IO](http://github.com/learnboost/socket.io)'s realtime core.\n\n## Features\n\n- Fast\n- Minimalistic\n  - Offers an integration API for higher-level impls to handle authorization,\n    routing, etc\n- Widest support of protocols\n  - Draft-75\n  - Draft-76\n  - Draft-00\n  - Protocol version 7\n  - Protocol version 8\n  - Protocol version 13\n- Written for Node 0.6\n\n## How to use\n\n### Standalone\n\n#### Listening on a port\n\n```js\nvar ws = require('websocket.io')\n  , server = ws.listen(3000)\n\nserver.on('connection', function (client) {\n  client.on('message', function () { });\n  client.on('close', function () { });\n});\n```\n\n#### Intercepting WebSocket requests for a http.Server\n\n```js\nvar ws = require('websocket.io')\n  , http = require('http').createServer().listen(3000)\n  , server = ws.attach(http)\n\nserver.on('connection', function (client) {\n  client.on('message', function () { });\n  client.on('close', function () { });\n});\n```\n\n### Passing in requests\n\n```js\nvar ws = require('websocket.io')\n  , server = new ws.Server()\n\n// … somewhere in your http server code\nserver.on('upgrade', function (req, socket, head) {\n  server.handleUpgrade(req, socket, head);\n});\n```\n\n### Client-side example\n\n```js\nvar ws = new WebSocket(\"ws://host:port/\");        \n\nsocket.onopen = function() {\n //do something when connection estabilished\n};\n\nsocket.onmessage = function(message) {\n //do something when message arrives\n};\n\nsocket.onclose = function() {\n //do something when connection close\n};\n\n```\n\n## API\n\n<hr><br>\n\n### Top-level\n\nThese are exposed by `require('websocket.io')`\n\n#### Properties\n\n- `version` _(String)_: protocol revision number\n- `Server` _(Function)_: server constructor\n- `Socket` _(Function)_: client constructor\n- `Logger` _(Function)_: logger constructor\n- `protocols` _(Object)_: hash of different `Socket` constructors for each protocol\n    - `drafts` _(Function)_: client for drafts 75/76/00\n    - `7` _(Function)_: client for protocol 7\n    - `8` _(Function)_: client for protocol 8\n    - `13` _(Function)_: client for protocol 13\n\n#### Methods\n\n- `listen`\n    - Creates an `http.Server` which listens on the given port and attaches WS\n      to it. It returns `501 Not Implemented` for regular http requests.\n    - **Parameters**\n      - `Number`: port to listen on.\n      - `Function`: callback for `listen`. The options object can be supplied\n        as second parameter as well.\n      - `Object`: optional, options object. See `Server` constructor API for\n        options.\n    - **Returns** `Server`\n- `attach`\n    - Captures `upgrade` requests for a `http.Server`. In other words, makes\n      a regular http.Server websocket-compatible.\n    - **Parameters**\n      - `http.Server`: server to attach to.\n      - `Object`: optional, options object. See `Server` constructor API for\n        options.\n    - **Returns** `Server`\n\n<hr><br>\n\n### Server\n\n#### Events\n\n- `connection`\n    - Fired when a new connection is established.\n    - **Arguments**\n      - `Socket`: a Socket object\n\n#### Methods\n\n- **constructor**\n    - Initializes the server\n    - **Parameters**\n      - `Object`: optional, options object\n    - **Options**\n      - `logger` (`Object`/`Boolean`): logger object. If you want to customize the\n        logger options, please supply a new `Logger` object (see API below). If you\n        want to enable it, set this option to `true`.\n- ``handleUpgrade``\n    - Handles an incoming request that triggered an `upgrade` event\n    - **Parameters**\n      - `http.Request`: http request\n      - `http.Stream`: request socket\n      - `Buffer`: stream head\n    - **Returns** `Server`\n\n<hr><br>\n\n### Socket\n\n#### Events\n\n- `message`\n    - Fired when data is received.\n    - **Arguments**\n      - `String`: data\n- `close`\n    - Fired when the connection is closed.\n\n#### Properties\n\n- `open`\n    - Whether the socket is open for writing\n\n#### Methods\n\n- ``send``\n    - Sends data to the socket.\n    - **Parameters**\n      - `String`: data to send\n    - **Returns** `Socket`\n- ``close``\n    - Closes the socket.\n    - **Returns** `Socket`\n- ``destroy``\n    - Forcibly closes the socket.\n    - **Returns** `Socket`\n\n<hr><br>\n\n### Logger\n\n#### Methods\n\n- **constructor**\n    - Initializes the logger\n    - **Parameters**\n      - `Object`: optional, options object\n    - **Options**\n      - `enabled` (`Boolean`): whether to output to the console (`false`).\n      - `log level` (`Number`): log level (`3`).\n      - `colors` (`Boolean`): whether to output colors (`true`).\n\n#### Methods\n\n- **log**\n- **debug**\n- **warn**\n- **info**\n\n## Support\n\nThe support channels for `websocket.io` are the same as `socket.io`:\n\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```\ngit clone git://github.com/LearnBoost/websocket.io.git\n```\n\nThen:\n\n```\ncd websocket.io\nnpm install\n```\n\n## Tests\n\n```\n$ make test\n```\n## Benchmarks\n\n```\n$ make bench\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2011 Guillermo Rauch &lt;guillermo@learnboost.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","_attachments":{}}