How to use the @expo/ngrok.addListener function in @expo/ngrok

To help you get started, we’ve selected a few @expo/ngrok 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 / xdl / src / Project.js View on Github external
await stopTunnelsAsync(projectRoot);
  if (await Android.startAdbReverseAsync(projectRoot)) {
    ProjectUtils.logInfo(
      projectRoot,
      'expo',
      'Successfully ran `adb reverse`. Localhost urls should work on the connected Android device.',
      'project-adb-reverse'
    );
  } else {
    ProjectUtils.clearNotification(projectRoot, 'project-adb-reverse');
  }
  const { username } = user;
  let packageShortName = path.parse(projectRoot).base;
  let expRc = await ProjectUtils.readExpRcAsync(projectRoot);

  ngrok.addListener('statuschange', status => {
    if (status === 'reconnecting') {
      ProjectUtils.logError(
        projectRoot,
        'expo',
        'We noticed your tunnel is having issues. This may be due to intermittent problems with our tunnel provider. If you have trouble connecting to your app, try to Restart the project, or switch Host to LAN.'
      );
    } else if (status === 'online') {
      ProjectUtils.logInfo(projectRoot, 'expo', 'Tunnel connected.');
    }
  });

  try {
    let startedTunnelsSuccessfully = false;

    // Some issues with ngrok cause it to hang indefinitely. After
    // TUNNEL_TIMEOUTms we just throw an error.
github expo / expo-cli / packages / xdl / src / Project.js View on Github external
ngrokPid: ngrok.process().pid,
      });

      startedTunnelsSuccessfully = true;

      ProjectUtils.logWithLevel(
        projectRoot,
        'info',
        {
          tag: 'expo',
          _expoEventType: 'TUNNEL_READY',
        },
        'Tunnel ready.'
      );

      ngrok.addListener('statuschange', status => {
        if (status === 'reconnecting') {
          ProjectUtils.logError(
            projectRoot,
            'expo',
            'We noticed your tunnel is having issues. ' +
              'This may be due to intermittent problems with our tunnel provider. ' +
              'If you have trouble connecting to your app, try to Restart the project, ' +
              'or switch Host to LAN.'
          );
        } else if (status === 'online') {
          ProjectUtils.logInfo(projectRoot, 'expo', 'Tunnel connected.');
        }
      });
    })(),
  ]);
github expo / expo-cli / packages / xdl / src / Project.ts View on Github external
ngrokPid: ngrok.process().pid,
      });

      startedTunnelsSuccessfully = true;

      ProjectUtils.logWithLevel(
        projectRoot,
        'info',
        {
          tag: 'expo',
          _expoEventType: 'TUNNEL_READY',
        },
        'Tunnel ready.'
      );

      ngrok.addListener('statuschange', (status: string) => {
        if (status === 'reconnecting') {
          ProjectUtils.logError(
            projectRoot,
            'expo',
            'We noticed your tunnel is having issues. ' +
              'This may be due to intermittent problems with our tunnel provider. ' +
              'If you have trouble connecting to your app, try to Restart the project, ' +
              'or switch Host to LAN.'
          );
        } else if (status === 'online') {
          ProjectUtils.logInfo(projectRoot, 'expo', 'Tunnel connected.');
        }
      });
    })(),
  ]);

@expo/ngrok

node wrapper for ngrok

BSD-2-Clause
Latest version published 12 months ago

Package Health Score

64 / 100
Full package analysis