index: api cleanup

This commit is contained in:
Guillermo Rauch
2012-12-14 10:07:07 -03:00
parent c695065c7a
commit 9c2224cca0

View File

@@ -78,7 +78,8 @@ Server.prototype.path = function(v){
* Attaches socket.io to a server or port.
*
* @param {http.Server|Number} server or port
* @param {Object} options
* @param {Object} options passed to engine.io
* @return {Server} self
* @api public
*/
@@ -92,6 +93,7 @@ Server.prototype.attach = function(srv, opts){
srv = engine.attach(srv, opts);
}
this.bind(srv);
return this;
};
/**
@@ -141,17 +143,21 @@ Server.prototype.serve = function(srv){
* Binds socket.io to an engine.io instance.
*
* @param {engine.Server} engine.io (or compatible) server
* @return {Server} self
* @api public
*/
Server.prototype.bind = function(engine){
this.engine = engine;
this.engine.on('connection', this.onconnection.bind(this));
return this;
};
/**
* Called with each incoming transport connection.
*
* @param {engine.Socket} socket
* @return {Server} self
* @api public
*/
@@ -160,6 +166,7 @@ Server.prototype.onconnection = function(conn){
var client = new Client(this, conn);
client.connect('/');
this.emit('client', client);
return this;
};
/**