1
0
Fork 0
Youpp/Youpp.app/Contents/Resources/app.nw/node_modules/socket.io/package.json

75 lines
11 KiB
JSON
Raw Normal View History

2014-03-07 21:51:43 +08:00
{
"name": "socket.io",
"version": "0.9.16",
"description": "Real-time apps made cross-browser & easy with a WebSocket-like API",
"homepage": "http://socket.io",
"keywords": [
"websocket",
"socket",
"realtime",
"socket.io",
"comet",
"ajax"
],
"author": {
"name": "Guillermo Rauch",
"email": "guillermo@learnboost.com"
},
"contributors": [
{
"name": "Guillermo Rauch",
"email": "rauchg@gmail.com"
},
{
"name": "Arnout Kazemier",
"email": "info@3rd-eden.com"
},
{
"name": "Vladimir Dronnikov",
"email": "dronnikov@gmail.com"
},
{
"name": "Einar Otto Stangvik",
"email": "einaros@gmail.com"
}
],
"repository": {
"type": "git",
"url": "https://github.com/LearnBoost/socket.io.git"
},
"dependencies": {
"socket.io-client": "0.9.16",
"policyfile": "0.0.4",
"base64id": "0.1.0",
"redis": "0.7.3"
},
"devDependencies": {
"expresso": "0.9.2",
"should": "*",
"benchmark": "0.2.2",
"microtime": "0.1.3-1",
"colors": "0.5.1"
},
"optionalDependencies": {
"redis": "0.7.3"
},
"main": "index",
"engines": {
"node": ">= 0.4.0"
},
"scripts": {
"test": "make test"
},
"readme": "# Socket.IO\n\nSocket.IO is a Node.JS project that makes WebSockets and realtime possible in\nall browsers. It also enhances WebSockets by providing built-in multiplexing,\nhorizontal scalability, automatic JSON encoding/decoding, and more.\n\n## How to Install\n\n```bash\nnpm install socket.io\n```\n\n## How to use\n\nFirst, require `socket.io`:\n\n```js\nvar io = require('socket.io');\n```\n\nNext, attach it to a HTTP/HTTPS server. If you're using the fantastic `express`\nweb framework:\n\n#### Express 3.x\n\n```js\nvar app = express()\n , server = require('http').createServer(app)\n , io = io.listen(server);\n\nserver.listen(80);\n\nio.sockets.on('connection', function (socket) {\n socket.emit('news', { hello: 'world' });\n socket.on('my other event', function (data) {\n console.log(data);\n });\n});\n```\n\n#### Express 2.x\n\n```js\nvar app = express.createServer()\n , io = io.listen(app);\n\napp.listen(80);\n\nio.sockets.on('connection', function (socket) {\n socket.emit('news', { hello: 'world' });\n socket.on('my other event', function (data) {\n console.log(data);\n });\n});\n```\n\nFinally, load it from the client side code:\n\n```html\n<script src=\"/socket.io/socket.io.js\"></script>\n<script>\n var socket = io.connect('http://localhost');\n socket.on('news', function (data) {\n console.log(data);\n socket.emit('my other event', { my: 'data' });\n });\n</script>\n```\n\nFor more thorough examples, look at the `examples/` directory.\n\n## Short recipes\n\n### Sending and receiving events.\n\nSocket.IO allows you to emit and receive custom events.\nBesides `connect`, `message` and `disconnect`, you can emit custom events:\n\n```js\n// note, io.listen(<port>) will create a http server for you\nvar io = require('socket.io').listen(80);\n\nio.sockets.on('connection', function (socket) {\n io.sockets.emit('this', { will: 'be received by everyone' });\n\n socket.on('private message', function (from, msg) {\n console.log('I received a private message by ', from, ' saying ', msg);\n });\n\n socket.on('disconnect', function () {\n io.sockets.emit('user disconnected');\n });\n});\n```\n\n### Storing data associated to a client\n\nSometimes it's necessary to store data associated with a client that's\nnecessary for the duration of the session.\n\n#### Server side\n\n```js\nvar io = require('socket.io').listen(80);\n\nio.sockets.on('connection', function (socket) {\n socket.on('set nickname', function (name) {\n socket.set('nickname', name, function () { socket.emit('ready'); });\n });\n\n socket.on('msg', function () {\n socket.get('nickname', function (err, name) {\n console.log('Chat message by ', name);\n });\n });\n});\n```\n\n#### Client side\n\n```html\n<script>\n var socket = io.connect('http://localhost');\n\n socket.on('connect', function () {\n socket.emit('set nickname', prompt('What is your nickname?'));\n socket.on('ready', function () {\n console.log('Connected !');\n socket.emit('msg', prompt('What is your message?'));\n });\n });\n</script>\n```\n\n### Restricting yourself to a namespace\n\nIf you have control over all the messages and events emitted for a particular\napplication, using the default `/` namespace works.\n\nIf you want to leverage 3rd-party code, or produce code to share with others,\nsocket.io provides a way of namespacing a `socket`.\n\nThis has the benefit of `multiplexing` a single connection. Instead of\nsocket.io using two `WebSocket` connections, it'll use one.\n\nThe following example defines a socket that listens on '/chat' and one for\n'/news':\n\n#### Server side\n\n```js\nvar io = require('socket.io').listen(80);\n\nvar chat = io\n .of('/chat')\n .on('connection', function (socket) {\n socket.emit('a message', { that: 'only', '/chat': 'will get' });\n chat.emit('a message', { everyone: 'in', '/chat': 'will get' });\n });\n\nvar news = io\n .of('/news');\n .on('connection', function (socket) {\n socket.emit('item', { news: 'item' });\n });\n```\n\n#### Client side:\n\n```html\n
"readmeFilename": "Readme.md",
"bugs": {
"url": "https://github.com/LearnBoost/socket.io/issues"
},
"_id": "socket.io@0.9.16",
"dist": {
"shasum": "58f8937954f77d4900bed50cf6372f0ade215fe9"
},
"_from": "socket.io@",
"_resolved": "https://registry.npmjs.org/socket.io/-/socket.io-0.9.16.tgz"
}