Skip to content

Commit

Permalink
index: added Server#adaptor
Browse files Browse the repository at this point in the history
  • Loading branch information
rauchg committed Dec 18, 2012
1 parent 2e5fdb6 commit fb857bd
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

/**
Expand Down Expand Up @@ -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
*/

Expand All @@ -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
*/

Expand All @@ -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.
*
Expand Down

0 comments on commit fb857bd

Please sign in to comment.