MCPcopy Index your code
hub / github.com/WebThingsIO/webthing-node / start

Method start

lib/server.ts:854–882  ·  view source on GitHub ↗

* Start listening for incoming connections. * * @returns {Promise} Promise which resolves once the server is started.

()

Source from the content-addressed store, hash-verified

852 * @returns {Promise} Promise which resolves once the server is started.
853 */
854 start(): Promise<void> {
855 const opts: dnssd.Options = {
856 name: this.name,
857 txt: {
858 path: '/',
859 },
860 };
861
862 if (this.app.isTls) {
863 opts.txt.tls = '1';
864 }
865
866 this.mdns = new dnssd.Advertisement(
867 new dnssd.ServiceType('_webthing._tcp'),
868 this.port!,
869 opts
870 );
871 this.mdns.on('error', (e) => {
872 console.debug(`mDNS error: ${e}`);
873 setTimeout(() => {
874 this.mdns.start();
875 }, 10000);
876 });
877 this.mdns.start();
878
879 return new Promise((resolve) => {
880 this.server.listen({port: this.port}, resolve);
881 });
882 }
883
884 /**
885 * Stop listening.

Callers 7

runServerFunction · 0.95
runServerFunction · 0.95
runServerFunction · 0.95
runServerFunction · 0.95
wsMethod · 0.45
postMethod · 0.45
postMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected