Servicedock: Webgui for Docker Swarm. Manage Docker Swarm a a Service.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

64 lines
13 KiB

{
"name": "socket.io",
"version": "1.4.4",
"description": "node.js realtime framework server",
"keywords": [
"realtime",
"framework",
"websocket",
"tcp",
"events",
"socket",
"io"
],
"main": "./lib/index",
"license": "MIT",
"repository": {
"type": "git",
"url": "git://github.com/Automattic/socket.io"
},
"scripts": {
"test": "mocha --reporter dot --slow 200ms --bail"
},
"dependencies": {
"engine.io": "1.6.7",
"socket.io-parser": "2.2.6",
"socket.io-client": "1.4.4",
"socket.io-adapter": "0.4.0",
"has-binary": "0.1.7",
"debug": "2.2.0"
},
"devDependencies": {
"expect.js": "0.3.1",
"istanbul": "0.2.3",
"mocha": "2.3.4",
"superagent": "0.17.0",
"supertest": "0.8.2",
"zuul-ngrok": "3.1.0"
},
"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/socketio/socket.io.svg)](https://travis-ci.org/socketio/socket.io)\n![NPM version](https://badge.fury.io/js/socket.io.svg)\n![Downloads](https://img.shields.io/npm/dm/socket.io.svg?style=flat)\n[![](http://slack.socket.io/badge.svg?)](http://slack.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').createServer();\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').createServer(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').createServer(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/socketio/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/socketio/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### Server#origins(v:Function):Server\n\n Sets the allowed origins as dynamic function. Function takes two arguments `origin:String` and `callback(error, success)`, where `success` is a boolean value indicating whether origin is allowed or not.\n\n __Potential drawbacks__:\n * in some situations, when it is not possible to determine `origin` it may have value of `*`\n * As this function will be executed for every request, it is advised to make this function work as fast as possible\n * If `socket.io` is used together with `Express`, the CORS headers will be affected only for `socket.io` requests. For Express can use [cors](https://github.com/expressjs/cors)\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#close\n\n Closes socket server\n\n ```js\n var Server = require('socket.io');\n var PORT = 3030;\n var server = require('http').Server();\n\n var io = Server(PORT);\n\n io.close(); // Close current server\n\n server.listen(PORT); // PORT is free to use\n\n io = Server(server);\n ```\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#clients(fn:Function)\n\n Gets a list of client IDs connected to this namespace (across all nodes if applicable).\n\n An example to get all clients in a namespace:\n\n ```js\n var io = require('socket.io')();\n io.of('/chat').clients(function(error, clients){\n if (error) throw error;\n console.log(clients); // => [PZDoMHjiu8PYfRiKAAAF, Anw2LatarvGVVXEIAAAD]\n });\n ```\n\n An example to get all clients in namespace's room:\n\n ```js\n var io = require('socket.io')();\n io.of('/chat').in('general').clients(function(error, clients){\n if (error) throw error;\n console.log(clients); // => [Anw2LatarvGVVXEIAAAD]\n });\n ```\n\n As with broadcasting, the default is all clients from the default namespace ('/'):\n\n ```js\n var io = require('socket.io')();\n io.clients(function(error, clients){\n if (error) throw error;\n console.log(clients); // => [6em3d4TJP8Et9EMNAAAA, G5p55dHhGgUnLUctAAAB]\n });\n ```\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 underlying `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/socketio/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/socketio/socket.io-adapter).\n\n### Socket#to(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### Socket#in(room:String):Socket\n\n Same as `Socket#to`\n\n### Socket#compress(v:Boolean):Socket\n\n Sets a modifier for a subsequent event emission that the event data will\n only be _compressed_ if the value is `true`. Defaults to `true` when you don't call the method.\n\n ```js\n var io = require('socket.io')();\n io.on('connection', function(socket){\n socket.compress(false).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](https://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/Automattic/socket.io/issues"
},
"_id": "socket.io@1.4.4",
"_from": "socket.io@"
}