-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackage.json
48 lines (48 loc) · 7.47 KB
/
package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{
"name": "websocket.io",
"description": "Socket.IO websocket server",
"version": "0.2.1",
"contributors": [
{
"name": "Guillermo Rauch",
"email": "[email protected]"
},
{
"name": "Einar Otto Stangvik",
"email": "[email protected]"
},
{
"name": "Arnout Kazemier",
"email": "[email protected]"
},
{
"name": "Nico Kaiser",
"email": "[email protected]"
},
{
"name": "Andor Goetzendorff",
"email": "[email protected]"
}
],
"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"
},
"readme": "WebSocket.IO\n============\n\n[![Build Status](https://secure.travis-ci.org/LearnBoost/websocket.io.png)](http://travis-ci.org/LearnBoost/websocket.io)\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### Server\n\n#### (A) Listening on a port\n\n```js\nvar ws = require('websocket.io')\n , server = ws.listen(3000)\n\nserver.on('connection', function (socket) {\n socket.on('message', function () { });\n socket.on('close', function () { });\n});\n```\n\n#### (B) 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 (socket) {\n socket.on('message', function () { });\n socket.on('close', function () { });\n});\n```\n\n#### (C) Passing in requests\n\n```js\nvar ws = require('websocket.io')\n , server = new ws.Server()\n\nserver.on('connection', function (socket) {\n socket.send('hi');\n});\n\n// …\nhttpServer.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### Server\n\n<hr><br>\n\n#### Top-level\n\nThese are exposed by `require('websocket.io')`:\n\n##### Properties\n\n- `version` _(String)_: websocket.io version\n- `protocols` _(Object)_: constructors for drafts 75/76/00, protocols 7/8/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 - `Object`: optional options object. See `Server` for options details.\n - `Function`: callback for `listen`\n - **Returns** `Server`\n- `attach`\n - Captures `upgrade` requests for a `http.Server`. In other words, makes a regular `http.Server` websocket-compatible.\n - **Parameters**\n - `http.Server`: server to attach to.\n - `Object`: optional, options object. See `Server` for options details.\n - **Returns** `Server`\n\n<hr><br>\n\n#### Server\n\nThe main server/manager. _Inherits from EventEmitter_.\n\n##### Properties\n\n- `clients` _(Object)_: table of all connected clients. This property is\n not set when the `Server` option `clientTracking` is `false`.\n- `clientsCount` _(Number)_: total count of connected clients. This property is\n not set when the `Server` option `clientTracking` is `false`.\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 - **Options**\n - path (`String`): if set, server only listens to request for this path\n - clientTracking (`Boolean`): enables client tracking. The\n `Server#clients` property only is available when this is true (`true`)\n- `handleUpgrade`\n\n<hr><br>\n\n#### Socket\n\nA representation of a client. _Inherits from EventEmitter_.\n\n##### Properties\n\n- `req` _(http.ServerRequest)_: Request that originated the connection.\n- `socket` _(net.Socket)_: Stream that originated the connection.\n- `readyState` _(String)_: `opening`, `open`, `closed`.\n- `name` _(String)_: `websocket-hixie`, `websocket`.\n- `protocolVersion` _(String)_: `hixie-75`, `hixie-76` and `hybi`.\n\n##### Events\n\n- `close`\n - Fired when the connection is closed.\n- `message`/`data`\n - Fired when data is received\n - **Arguments**\n - `String`: utf-8 string\n- `error`\n - Fired when an error occurs.\n - **Arguments**\n - `Error`: error object\n\n##### Methods\n\n- `send` / `write`\n - Sends a message.\n - **Parameters**\n - `String`: utf-8 string with outgoing data\n - **Returns** `Socket` for chaining\n- `close` / `end`\n - Closes the socket\n - **Returns** `Socket` for chaining\n- `destroy`\n - Forcibly closes the socket.\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\n## Credits\n\nWebSocket.IO is possible thanks to the contributions by:\n\n- Einar Otto Stangvik [[email protected]]\n- Arnout Kazemier [[email protected]]\n- Nico Kaiser [[email protected]]\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2011 Guillermo Rauch <[email protected]>\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",
"readmeFilename": "README.md",
"_id": "[email protected]",
"_from": "websocket.io@"
}