mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-30 03:00:39 -04:00
29 lines
392 B
JavaScript
29 lines
392 B
JavaScript
/**
|
|
* Module dependencies.
|
|
*/
|
|
|
|
var eio = require("..");
|
|
|
|
/**
|
|
* Listen shortcut that fires a callback on an ephemeral port.
|
|
*/
|
|
|
|
exports.listen = function(opts, fn) {
|
|
if ("function" === typeof opts) {
|
|
fn = opts;
|
|
opts = {};
|
|
}
|
|
|
|
var e = eio.listen(0, opts, function() {
|
|
fn(e.httpServer.address().port);
|
|
});
|
|
|
|
return e;
|
|
};
|
|
|
|
/**
|
|
* Sprintf util.
|
|
*/
|
|
|
|
require("s").extend();
|