1
0
Fork 0
sfxboard/node_modules/socket.io/package.json

65 lines
11 KiB
JSON

{
"name": "socket.io",
"version": "1.0.6",
"description": "node.js realtime framework server",
"keywords": [
"realtime",
"framework",
"websocket",
"tcp",
"events",
"socket",
"io"
],
"repository": {
"type": "git",
"url": "git://github.com/LearnBoost/socket.io"
},
"scripts": {
"test": "make test"
},
"dependencies": {
"engine.io": "1.3.1",
"socket.io-parser": "2.2.0",
"socket.io-client": "1.0.6",
"socket.io-adapter": "0.2.0",
"has-binary-data": "0.1.1",
"debug": "0.7.4"
},
"devDependencies": {
"mocha": "1.16.2",
"expect.js": "0.3.1",
"supertest": "0.8.2",
"superagent": "0.17.0",
"istanbul": "0.2.3"
},
"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"
}
],
"readme": "\n# socket.io\n\n[![Build Status](https://secure.travis-ci.org/Automattic/socket.io.png)](http://travis-ci.org/Automattic/socket.io)\n[![NPM version](https://badge.fury.io/js/socket.io.png)](http://badge.fury.io/js/socket.io)\n\n## How to use\n\nThe following example attaches socket.io to a plain Node.JS\nHTTP server listening on port `3000`.\n\n```js\nvar server = require('http').Server();\nvar io = require('socket.io')(server);\nio.on('connection', function(socket){\n socket.on('event', function(data){});\n socket.on('disconnect', function(){});\n});\nserver.listen(3000);\n```\n\n### Standalone\n\n```js\nvar io = require('socket.io')();\nio.on('connection', function(socket){});\nio.listen(3000);\n```\n\n### In conjunction with Express\n\nStarting with **3.0**, express applications have become request handler\nfunctions that you pass to `http` or `http` `Server` instances. You need\nto pass the `Server` to `socket.io`, and not the express application\nfunction.\n\n```js\nvar app = require('express')();\nvar server = require('http').Server(app);\nvar io = require('socket.io')(server);\nio.on('connection', function(){ /* … */ });\nserver.listen(3000);\n```\n\n### In conjunction with Koa\n\nLike Express.JS, Koa works by exposing an application as a request\nhandler function, but only by calling the `callback` method.\n\n```js\nvar app = require('koa')();\nvar server = require('http').Server(app.callback());\nvar io = require('socket.io')(server);\nio.on('connection', function(){ /* … */ });\nserver.listen(3000);\n```\n\n## API\n\n### Server\n\n Exposed by `require('socket.io')`.\n\n### Server()\n\n Creates a new `Server`. Works with and without `new`:\n\n ```js\n var io = require('socket.io')();\n // or\n var Server = require('socket.io');\n var io = new Server();\n ```\n\n### Server(opts:Object)\n\n Optionally, the first or second argument (see below) of the `Server`\n constructor can be an options object.\n\n The following options are supported:\n\n - `serveClient` sets the value for Server#serveClient()\n - `path` sets the value for Server#path()\n\n The same options passed to socket.io are always passed to\n the `engine.io` `Server` that gets created. See engine.io\n [options](https://github.com/learnboost/engine.io#methods-1)\n as reference.\n\n### Server(srv:http#Server, opts:Object)\n\n Creates a new `Server` and attaches it to the given `srv`. Optionally\n `opts` can be passed.\n\n### Server(port:Number, opts:Object)\n\n Binds socket.io to a new `http.Server` that listens on `port`.\n\n### Server#serveClient(v:Boolean):Server\n\n If `v` is `true` the attached server (see `Server#attach`) will serve\n the client files. Defaults to `true`.\n\n This method has no effect after `attach` is called.\n\n ```js\n // pass a server and the `serveClient` option\n var io = require('socket.io')(http, { serveClient: false });\n\n // or pass no server and then you can call the method\n var io = require('socket.io')();\n io.serveClient(false);\n io.attach(http);\n ```\n\n If no arguments are supplied this method returns the current value.\n\n### Server#path(v:String):Server\n\n Sets the path `v` under which `engine.io` and the static files will be\n served. Defaults to `/socket.io`.\n\n If no arguments are supplied this method returns the current value.\n\n### Server#adapter(v:Adapter):Server\n\n Sets the adapter `v`. Defaults to an instance of the `Adapter` that\n ships with socket.io which is memory based. See\n [socket.io-adapter](https://github.com/Automattic/socket.io-adapter).\n\n If no arguments are supplied this method returns the current value.\n\n### Server#origins(v:String):Server\n\n Sets the allowed origins `v`. Defaults to any origins being allowed.\n\n If no arguments are supplied this method returns the current value.\n\n\n### Server#sockets:Namespace\n\n The default (`/`) namespace.\n\n### Server#attach(srv:http#Server, opts:Object):Server\n\n Attaches the `Server` to an engine.io instance on `srv` with the\n supplied `opts` (optionally).\n\n### Server#attach(port:Number, opts:Object):Server\n\n Attaches the `Server` to an engine.io instance that is bound to `port`\n with the given `opts` (optionally).\n\n### Server#listen\n\n Synonym of `Server#attach`.\n\n### Server#bind(srv:engine#Server):Server\n\n Advanced use only. Binds the server to a specific engine.io `Server` \n (or compatible API) instance.\n\n### Server#onconnection(socket:engine#Socket):Server\n\n Advanced use only. Creates a new `socket.io` client from the incoming\n engine.io (or compatible API) `socket`.\n\n### Server#of(nsp:String):Namespace\n\n Initializes and retrieves the given `Namespace` by its pathname \n identifier `nsp`.\n\n If the namespace was already initialized it returns it right away.\n\n### Server#emit\n\n Emits an event to all connected clients. The following two are \n equivalent:\n\n ```js\n var io = require('socket.io')();\n io.sockets.emit('an event sent to all connected clients');\n io.emit('an event sent to all connected clients');\n ```\n\n For other available methods, see `Namespace` below.\n\n### Server#use\n\n See `Namespace#use` below.\n\n### Namespace\n\n Represents a pool of sockets connected under a given scope identified\n by a pathname (eg: `/chat`).\n\n By default the client always connects to `/`.\n\n#### Events\n\n - `connection` / `connect`. Fired upon a connection.\n\n Parameters:\n - `Socket` the incoming socket.\n\n### Namespace#name:String\n\n The namespace identifier property.\n\n### Namespace#connected:Object<Socket>\n\n Hash of `Socket` objects that are connected to this namespace indexed\n by `id`.\n\n### Namespace#use(fn:Function):Namespace\n\n Registers a middleware, which is a function that gets executed for\n every incoming `Socket` and receives as parameter the socket and a\n function to optionally defer execution to the next registered\n middleware.\n\n ```js\n var io = require('socket.io')();\n io.use(function(socket, next){\n if (socket.request.headers.cookie) return next();\n next(new Error('Authentication error'));\n });\n ```\n\n Errors passed to middleware callbacks are sent as special `error`\n packets to clients.\n\n### Socket\n\n A `Socket` is the fundamental class for interacting with browser\n clients. A `Socket` belongs to a certain `Namespace` (by default `/`)\n and uses an underlying `Client` to communicate.\n\n### Socket#rooms:Array\n\n A list of strings identifying the rooms this socket is in.\n\n### Socket#client:Client\n\n A reference to the underlying `Client` object.\n\n### Socket#conn:Socket\n\n A reference to the underyling `Client` transport connection (engine.io\n `Socket` object).\n\n### Socket#request:Request\n\n A getter proxy that returns the reference to the `request` that\n originated the underlying engine.io `Client`. Useful for accessing\n request headers such as `Cookie` or `User-Agent`.\n\n### Socket#id:String\n\n A unique identifier for the socket session, that comes from the\n underlying `Client`.\n\n### Socket#emit(name:String[, …]):Socket\n\n Emits an event to the socket identified by the string `name`. Any\n other parameters can be included.\n\n All datastructures are supported, including `Buffer`. JavaScript\n functions can't be serialized/deserialized.\n\n ```js\n var io = require('socket.io')();\n io.on('connection', function(socket){\n socket.emit('an event', { some: 'data' });\n });\n ```\n\n### Socket#join(name:String[, fn:Function]):Socket\n\n Adds the socket to the `room`, and fires optionally a callback `fn`\n with `err` signature (if any).\n\n The socket is automatically a member of a room identified with its\n session id (see `Socket#id`).\n\n The mechanics of joining rooms are handled by the `Adapter`\n that has been configured (see `Server#adapter` above), defaulting to\n [socket.io-adapter](https://github.com/Automattic/socket.io-adapter).\n\n### Socket#leave(name:String[, fn:Function]):Socket\n\n Removes the socket from `room`, and fires optionally a callback `fn`\n with `err` signature (if any).\n\n **Rooms are left automatically upon disconnection**.\n\n The mechanics of leaving rooms are handled by the `Adapter`\n that has been configured (see `Server#adapter` above), defaulting to\n [socket.io-adapter](https://github.com/Automattic/socket.io-adapter).\n\n### Socket#to(room:String):Socket\n### Socket#in(room:String):Socket\n\n Sets a modifier for a subsequent event emission that the event will\n only be _broadcasted_ to sockets that have joined the given `room`.\n\n To emit to multiple rooms, you can call `to` several times.\n\n ```js\n var io = require('socket.io')();\n io.on('connection', function(socket){\n socket.to('others').emit('an event', { some: 'data' });\n });\n ```\n\n### Client\n\n The `Client` class represents an incoming transport (engine.io)\n connection. A `Client` can be associated with many multiplexed `Socket`\n that belong to different `Namespace`s.\n\n### Client#conn\n\n A reference to the underlying `engine.io` `Socket` connection.\n\n### Client#request\n\n A getter proxy that returns the reference to the `request` that\n originated the engine.io connection. Useful for accessing\n request headers such as `Cookie` or `User-Agent`.\n\n## Debug / logging\n\nSocket.IO is powered by [debug](http://github.com/visionmedia/debug).\nIn order to see all the debug output, run your app with the environment variable\n`DEBUG` including the desired scope.\n\nTo see the output from all of Socket.IO's debugging scopes you can use:\n\n```\nDEBUG=socket.io* node myapp\n```\n\n## License\n\nMIT\n",
"readmeFilename": "Readme.md",
"bugs": {
"url": "https://github.com/LearnBoost/socket.io/issues"
},
"homepage": "https://github.com/LearnBoost/socket.io",
"_id": "socket.io@1.0.6",
"_shasum": "b566532888dae3ac9058a12f294015ebdfa8084a",
"_from": "socket.io@*",
"_resolved": "https://registry.npmjs.org/socket.io/-/socket.io-1.0.6.tgz"
}