(dictionary = {})
| 300 | export 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; |