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

Method stop

lib/server.ts:890–916  ·  view source on GitHub ↗

* Stop listening. * * @param {boolean?} force - Whether or not to force shutdown immediately. * @returns {Promise} Promise which resolves once the server is stopped.

(force = false)

Source from the content-addressed store, hash-verified

888 * @returns {Promise} Promise which resolves once the server is stopped.
889 */
890 stop(force = false): Promise<unknown> {
891 const promises: Promise<void>[] = [];
892
893 if (this.mdns) {
894 promises.push(new Promise((resolve, reject) => {
895 this.mdns.stop(force, (error?: unknown) => {
896 if (error) {
897 reject(error);
898 } else {
899 resolve();
900 }
901 });
902 }));
903 }
904
905 promises.push(new Promise((resolve, reject) => {
906 this.server.close((error) => {
907 if (error) {
908 reject(error);
909 } else {
910 resolve();
911 }
912 });
913 }));
914
915 return Promise.all(promises);
916 }
917}

Callers 4

runServerFunction · 0.95
runServerFunction · 0.95
runServerFunction · 0.95
runServerFunction · 0.95

Calls 1

closeMethod · 0.45

Tested by

no test coverage detected