MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / constructor

Method constructor

modules/network/http/http.js:471–483  ·  view source on GitHub ↗
(dictionary = {})

Source from the content-addressed store, hash-verified

469 connections = [];
470
471 constructor(dictionary = {}) {
472 this.#listener = new Listener({port: 80, ...dictionary});
473 this.#listener.callback = listener => {
474 const socket = new Socket({listener: this.#listener, noDelay: true});
475 const request = new Request({socket}); // request class will work to receive request body
476 socket.callback = server.bind(request);
477 request.server = this; // associate server with request
478 request.state = 1; // already connected socket
479 request.callback = this.callback; // transfer server.callback to request.callback
480 this.connections.push(request);
481 request.callback(Server.connection); // tell app we have a new connection
482 };
483 }
484
485 close(connections = true) {
486 if (connections) {

Callers

nothing calls this directly

Calls 3

bindMethod · 0.45
pushMethod · 0.45
callbackMethod · 0.45

Tested by

no test coverage detected