Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot detect disconnections #155

Closed
ArthyFlette opened this issue Aug 20, 2024 · 3 comments
Closed

Cannot detect disconnections #155

ArthyFlette opened this issue Aug 20, 2024 · 3 comments

Comments

@ArthyFlette
Copy link

ArthyFlette commented Aug 20, 2024

Hi,

I am trying to detect when the ngrok connection drops with this code:

const listener = await ngrok.forward({ 
  
	  addr: config.ngrok.port, 
  
	  authtoken: config.ngrok.token,
  
	  on_status_change: (addr, error) => {
  
		  console.log(`disconnected, addr ${addr} error: ${error}`);
  
	  },
  
  });

console.log in on_status_change never triggers

Is there anything wrong with this code ?

@jrobsonchase
Copy link
Collaborator

Thanks for the issue!

This looks like it's somewhere between a bug and a documentation issue. The field is actually onStatusChange, and it should be a function that only takes a single string describing the change that occurred, e.g.

{
    onStatusChange: (status) => {
        console.log(`status change: ${status}`);
    },
}

@ArthyFlette
Copy link
Author

works like a charm, thanks :)

@russorat
Copy link
Contributor

@ArthyFlette glad to hear!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants