mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-08 03:00:20 -04:00
index: api cleanup
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user