How to use http.on:
43 44 45 46 47 48 49 50 51 52
} module.exports.listen = (callback, p) => { if (!_.isUndefined(p)) port = p server.on('error', err => { if (err.code === 'EADDRINUSE') { winston.error('Address in use, exiting...') server.close() } else {
How to use http.default:
GitHub: alexn1/qforms
607 608 609 610 611 612 613 614 615 616
res.json({foo: 'bar'}); }*/ createAndRunHttpServer(host, port) { return new Promise((resolve, reject) => { try { const httpServer = http_1.default.createServer(this.express); const tempErrorHandler = (err) => { console.error('tempErrorHandler', err); httpServer.off('error', tempErrorHandler); reject(err);
How to use http.sockets:
GitHub: skbeyagu/socket.io
103 104 105 106 107 108 109 110 111 112
- `options` _(Object)_ See [above](#new-serverhttpserver-options) for available options. #### server.sockets * _(Namespace)_ The default (`/`) namespace.
How to use http.onconnection:
GitHub: skbeyagu/socket.io
188 189 190 191 192 193 194 195 196
- `engine` _(engine.Server)_ - **Returns** `Server` Advanced use only. Binds the server to a specific engine.io `Server` (or compatible API) instance. #### server.onconnection(socket) - `socket` _(engine.Socket)_ - **Returns** `Server`
How to use http.once:
22 23 24 25 26 27 28 29 30 31
res.end('worker: ' + cluster.worker.id); }); if (!sticky.listen(server, 3000)) { // Master code server.once('listening', function() { console.log('server started on 3000 port'); }); } else { // Worker code
How to use http.of:
GitHub: skbeyagu/socket.io
195 196 197 198 199 200 201 202 203
- `socket` _(engine.Socket)_ - **Returns** `Server` Advanced use only. Creates a new `socket.io` client from the incoming engine.io (or compatible API) `Socket`. #### server.of(nsp) - `nsp` _(String)_ - **Returns** `Namespace`
How to use http.close:
46 47 48 49 50 51 52 53 54 55
if (!_.isUndefined(p)) port = p server.on('error', err => { if (err.code === 'EADDRINUSE') { winston.error('Address in use, exiting...') server.close() } else { winston.error(err.message) throw err }
How to use http.attach:
GitHub: skbeyagu/socket.io
166 167 168 169 170 171 172 173 174
- `httpServer` _(http.Server)_ the server to attach to - `options` _(Object)_ Attaches the `Server` to an engine.io instance on `httpServer` with the supplied `options` (optionally). ### server.attach(port[, options]) - `port` _(Number)_ the port to listen on - `options` _(Object)_
How to use http.origins:
GitHub: skbeyagu/socket.io
140 141 142 143 144 145 146 147 148
- `value` _(Adapter)_ - **Returns** `Server|Adapter` Sets the adapter `value`. Defaults to an instance of the `Adapter` that ships with socket.io which is memory based. See [socket.io-adapter](https://github.com/socketio/socket.io-adapter). If no arguments are supplied this method returns the current value. #### server.origins([value]) - `value` _(String)_ - **Returns** `Server|String`
How to use http._connectionListener:
How to use http.ClientRequest:
GitHub: manuel-serrano/hop
128 129 130 131 132 133 134 135 136 137
debug( "new Agent" ); options.agent = new Agent(options); } } return new http.ClientRequest(options, cb); }; exports.get = function(options, cb) { var req = exports.request(options, cb);
See more examples
How to use http.listen:
GitHub: Rastholia/ElectronAPP
15 16 17 18 19 20 21 22 23 24
function start(callback) { if (router.isStarted === false) { init(function () { loadRoutes(function () { /* Lance le serveur web sur le port 3000 */ http.listen(3000, function name(params) { console.log("Application is running on port 3000"); router.isStarted = true; if (typeof callback != "undefined") { callback();
How to use http.globalAgent:
180 181 182 183 184 185 186 187 188
Return another `http.Agent` instance to "pass through" the responsibility for that HTTP request to that agent: ```js agent(function (req, opts) { return opts.secureEndpoint ? https.globalAgent : http.globalAgent; }); ```
How to use http.STATUS_CODES:
352 353 354 355 356 357 358 359 360 361 362
/** * Send given HTTP status code. * * Sets the response status to `statusCode` and the body of the * response to the standard description from node's http.STATUS_CODES * or the statusCode number if no description. * * Examples: *
How to use http.get:
320 321 322 323 324 325 326 327 328 329
console.log("SonyWifi: Capture complete:", photoName); return callback && callback(err, {photoName, url}); // http.get(url, function(res) { // //res.setEncoding('binary'); // // var statusCode = res.statusCode; // var contentType = res.headers['content-type'];
How to use http.IncomingMessage:
3108 3109 3110 3111 3112 3113 3114 3115 3116 3117
options.unknownProtocolTimeout = 10000; // Used only with allowHTTP1 options.Http1IncomingMessage = options.Http1IncomingMessage || http.IncomingMessage; options.Http1ServerResponse = options.Http1ServerResponse || http.ServerResponse; options.Http2ServerRequest = options.Http2ServerRequest ||
See more examples
How to use http.ServerResponse:
3110 3111 3112 3113 3114 3115 3116 3117 3118 3119
// Used only with allowHTTP1 options.Http1IncomingMessage = options.Http1IncomingMessage || http.IncomingMessage; options.Http1ServerResponse = options.Http1ServerResponse || http.ServerResponse; options.Http2ServerRequest = options.Http2ServerRequest || Http2ServerRequest; options.Http2ServerResponse = options.Http2ServerResponse ||
See more examples
How to use http.Agent:
50 51 52 53 54 55 56 57 58 59
maxContentLength: (((1024 * 1024) * 1024) * 1024), maxBodyLength: (((1024 * 1024) * 1024) * 1024), httpsAgent: new https.Agent({ keepAlive: true }), httpAgent: new http.Agent({ keepAlive: true }), proxy: false, headers: {
See more examples
How to use http.Server:
GitHub: Barbosik/MultiOgar
34 35 36 37 38 39 40 41 42 43
// copy from http.Server this.timeout = 2 * 60 * 1000; this.allowHalfOpen = false; this.httpAllowHalfOpen = false; } else http.Server.call(this, requestListener); } inherits(Server, https.Server); Server.prototype.setTimeout = function (msecs, callback) {
See more examples
How to use http.request:
GitHub: PubFork/miniblink49
12 13 14 15 16 17 18 19 20 21
this.req = https.request(options); } else if (hasCrypto && "https:" == options.protocol) { this.req = https.request(options); } if (!this.req) this.req = http.request(options); } ClientRequest.prototype.on = function(evt, callback) { this.req.on(evt, callback);
See more examples
How to use http.createServer:
GitHub: cliss/camel
47 48 49 50 51 52 53 54 55 56 57
app.use(express.static("public")); app.use(function (request, response, next) { response.header('X-powered-by', 'Camel (https://github.com/cliss/camel)'); next(); }); var server = http.createServer(app); // "Statics" var postsRoot = './posts/'; var templateRoot = './templates/';
See more examples