How to use server-destroy - 7 common examples

To help you get started, we’ve selected a few server-destroy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github expo / expo / tools / expotools / src / Fixtures.ts View on Github external
manifestServer.listen(manifestFixturePort, function() {
    let port = (manifestServer.address() as net.AddressInfo).port;

    if (verbose) {
      // Print out url
      qrcodeTerminal.generate(`exp://${lanAddress}:${port}`, code =>
        console.log(`${indentString(code, 2)}\n`)
      );
      console.log(`Your fixture URL is: exp://${lanAddress}:${port}\n`);

      if (playbackSpeed !== 1.0) {
        console.log(`Playing at ${playbackSpeed}x speed.\n`);
      }
    }
  });
  enableDestroy(manifestServer);

  return `${lanAddress}:${manifestFixturePort}`;
}
github expo / expo / tools / expotools / src / Fixtures.ts View on Github external
packagerServer.on('request', (req, res) => {
    requestHandler('packager', req, res);
  });
  const wss = new WebSocket.Server({ server: packagerServer });
  wss.on('connection', (ws, req) => {
    // TODO: send/receive fixtures
    /*ws.on('message', function incoming(message) {
      console.log('received: %s', message);
    });

    ws.send('something');*/
  });

  packagerServer.listen(packagerFixturePort);
  enableDestroy(packagerServer);
  console.log(`Packager URL: exp://${lanAddress}:${packagerFixturePort}\n`);

  manifestServer.on('request', (req, res) => {
    requestHandler('manifest', req, res);
  });
  manifestServer.listen(manifestFixturePort, function() {
    let port = (manifestServer.address() as net.AddressInfo).port;

    if (verbose) {
      // Print out url
      qrcodeTerminal.generate(`exp://${lanAddress}:${port}`, code =>
        console.log(`${indentString(code, 2)}\n`)
      );
      console.log(`Your fixture URL is: exp://${lanAddress}:${port}\n`);

      if (playbackSpeed !== 1.0) {
github nuxt / nuxt.js / packages / server / src / listener.js View on Github external
// Prepare listenArgs
    const listenArgs = this.socket ? { path: this.socket } : { host: this.host, port: this.port }
    listenArgs.exclusive = false

    // Call server.listen
    try {
      this.server = await new Promise((resolve, reject) => {
        this._server.on('error', error => reject(error))
        const s = this._server.listen(listenArgs, error => error ? reject(error) : resolve(s))
      })
    } catch (error) {
      return this.serverErrorHandler(error)
    }

    // Enable destroy support
    enableDestroy(this.server)
    pify(this.server.destroy)

    // Compute listen URL
    this.computeURL()

    // Set this.listening to true
    this.listening = true
  }
github nuxt / nuxt.js / lib / core / nuxt.js View on Github external
consola.debug('server closed')
                  /* istanbul ignore if */
                  if (err) {
                    return reject(err)
                  }
                  resolve()
                })
              })
          )

          this.callHook('listen', server, { port, host }).then(resolve)
        }
      )

      // Add server.destroy(cb) method
      enableDestroy(server)
    }))
  }
github wojtkowiak / meteor-desktop / tests / helpers / autoupdate / meteorServer.js View on Github external
startHttpServer(restart) {
        try {
            this.httpServerInstance = http.createServer(this.server);
            this.httpServerInstance.on('error', (e) => {
                this.onStartupFailed(e);
            });
            this.httpServerInstance.on('listening', () => {
                if (restart) {
                    this.onServerRestarted(this.port);
                } else {
                    this.onServerReady(this.port);
                }
            });
            this.httpServerInstance.listen(this.port);
            enableDestroy(this.httpServerInstance);
        } catch (e) {
            this.onStartupFailed(e);
        }
    }
}
github tungv / jerni / packages / heq-client / fixtures / startServer.js View on Github external
new Promise(resolve => {
        const server = factory({
          namespc,
          redis: { url: redis },
          history: { size: 10 },
          debug: false,
        });

        enableDestroy(server);

        server.on('close', () => {
          console.log('closing', port);
          delete servers[port];
        });

        server.listen(port, () => {
          servers[port] = server;
          resolve(server);
        });
      })
  );
github wojtkowiak / meteor-desktop / skeleton / modules / localServer.js View on Github external
this.init(this.serverPath, this.parentServerPath, true);
                } else {
                    this.onStartupFailed(1);
                }
            });
            this.httpServerInstance.on('listening', () => {
                this.retries = 0;
                this.savePort();
                if (restart) {
                    this.onServerRestarted(this.port);
                } else {
                    this.onServerReady(this.port);
                }
            });
            this.httpServerInstance.listen(this.port, '127.0.0.1');
            enableDestroy(this.httpServerInstance);
        } catch (e) {
            this.log.error(e);
            this.onStartupFailed(1);
        }
    }
}

server-destroy

Enable destroying a server, and all currently open connections.

ISC
Latest version published 9 years ago

Package Health Score

67 / 100
Full package analysis

Popular server-destroy functions

Similar packages