mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-30 03:00:39 -04:00
48 lines
634 B
JavaScript
48 lines
634 B
JavaScript
|
|
/**
|
|
* Expose `eio` global.
|
|
*/
|
|
|
|
global.eio = require('../index');
|
|
|
|
/**
|
|
* Expose client.
|
|
*/
|
|
|
|
global.eioc = require('engine.io-client');
|
|
|
|
/**
|
|
* Expose `request` global.
|
|
*/
|
|
|
|
global.request = require('superagent');
|
|
|
|
/**
|
|
* Expose `expect` global
|
|
*/
|
|
|
|
global.expect = require('expect.js');
|
|
|
|
/**
|
|
* Listen shortcut that fires a callback on an epheemal port.
|
|
*/
|
|
|
|
global.listen = function (opts, fn) {
|
|
if ('function' == typeof opts) {
|
|
fn = opts;
|
|
opts = {};
|
|
}
|
|
|
|
var e = global.eio.listen(null, opts, function () {
|
|
fn(e.httpServer.address().port);
|
|
});
|
|
|
|
return e;
|
|
};
|
|
|
|
/**
|
|
* Sprintf util.
|
|
*/
|
|
|
|
require('s').extend();
|