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