Open sammachin opened 1 month ago
Hello @sammachin, have you tried the kill
function? Or ngrok.disconnect
without any url? I'll investigate further why the session/agent is not closing when using the listener
.
@nikolay-ngrok Hi, thanks for responding, tried both the ngrok.kill()
and ngrok.disconnect()
but they have the same effect the tunnel is stopped but not the agent.
Another option to try is to control the session explicitly - instead of using the listener factory methods, you could connect a session and later close it when you need? e.g. start with https://github.com/ngrok/ngrok-javascript/blob/main/examples/ngrok-http-minimum.js#L13 and then do https://ngrok.github.io/ngrok-javascript/classes/Session.html#close when you need it?
@nikolay-ngrok creating the session manually seems to work, but thats a lot of work to do in my code to refactor it for all the options that a user can set, any chance this can be fixed in the ngrok module so that at least kill()
stops the agent.
just dropping a note here that we're actively working through the design of the next api rev for our SDKs and this is one of the improvements we're going to work on incorporating into the design
I then have an wish, if this is not in the pipe line. It could be nice that when using ngrok website that the part with tunnel/agent stop / restart etc. would work with the agent. Just a small wish. :-)
@inconshreveable Thanks Alan, what sort of timeframe are we looking at to update the SDK? I could refactor my library to control the session directly but thats not a small amount of work and I don't really want to invest my time if its going to be solved upstream as soon as I finish!
@sammachin i can't commit to a timeline here but i'd say "no earlier than october"
@grawsom it sounds like you're asking for the SDK to close the session when you use the dashboard 'stop' function, yes?
@inconshreveable I'm just a user and when I install the Ngrok the "normal" way i then have some control in the website.
https://dashboard.ngrok.com/tunnels/agents
How it would work in your code i don't know, i just know that you could not do this by @sammachin package that uses you code.
When I close a connection using either the
listener.close()
or thengrok.disconnect(listener.url())
methods it does not close down the agent session, I can see the agent still active in my dashboard (with 0 tunnels)This means that I am unable to start a new agent on another machine as I get the error:
According to the docs:
The close method on a listener will shut it down, and also stop the ngrok session if it is no longer needed.
But this does not seem to be working on either 1.0.0, or 1.3.0