index: added Server#adaptor

This commit is contained in:
Guillermo Rauch
2012-12-18 18:09:41 -03:00
parent 2e5fdb65bd
commit fb857bd8b4

View File

@@ -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.
*