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

Method constructor

modules/network/websocket/websocket.js:302–311  ·  view source on GitHub ↗
(dictionary = {})

Source from the content-addressed store, hash-verified

300export class Server {
301 #listener;
302 constructor(dictionary = {}) {
303 if (null === dictionary.port)
304 return;
305
306 this.#listener = new Listener({port: dictionary.port ?? 80});
307 this.#listener.callback = () => {
308 const request = addClient(new Socket({listener: this.#listener}), 1, this.callback);
309 request.callback(Server.connect, this); // tell app we have a new connection
310 };
311 }
312 close() {
313 this.#listener?.close();
314 this.#listener = undefined;

Callers

nothing calls this directly

Calls 2

addClientFunction · 0.85
callbackMethod · 0.45

Tested by

no test coverage detected