mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-30 03:00:39 -04:00
index: added Server#adaptor
This commit is contained in:
20
lib/index.js
20
lib/index.js
@@ -9,6 +9,7 @@ var http = require('http')
|
||||
, engine = require('engine.io')
|
||||
, Client = require('./client')
|
||||
, Namespace = require('./namespace')
|
||||
, Adaptor = require('./adaptor')
|
||||
, debug = require('debug')('socket.io:server');
|
||||
|
||||
/**
|
||||
@@ -45,13 +46,15 @@ function Server(srv, opts){
|
||||
this.sockets = this.of('/');
|
||||
this.path(opts.path || '/socket.io');
|
||||
this.static(false !== opts.static);
|
||||
this.adaptor(opts.adaptor || new Adaptor);
|
||||
if (srv) this.attach(srv, opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serve client code.
|
||||
* Sets/gets whether client code is being served.
|
||||
*
|
||||
* @param {Boolean} whether to serve client code
|
||||
* @return {Server|Boolean} self when setting or value when getting
|
||||
* @api public
|
||||
*/
|
||||
|
||||
@@ -65,6 +68,7 @@ Server.prototype.static = function(v){
|
||||
* Sets the client serving path.
|
||||
*
|
||||
* @param {String} pathname
|
||||
* @return {Server|String} self when setting or value when getting
|
||||
* @api public
|
||||
*/
|
||||
|
||||
@@ -74,6 +78,20 @@ Server.prototype.path = function(v){
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the adaptor for rooms.
|
||||
*
|
||||
* @param {Adaptor} pathname
|
||||
* @return {Server|Adaptor} self when setting or value when getting
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Server.prototype.adaptor = function(v){
|
||||
if (!arguments.length) return this._adaptor;
|
||||
this._adaptor = v;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Attaches socket.io to a server or port.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user