Comments (2)
Thank you for the clear description and repro code, appreciated!
The default behavior is as you describe, though I believe it's possible to also make it fail fast on session errors like so:
sess, err := ngrok.Connect(
ctx,
ngrok.WithAuthtoken(authToken),
ngrok.WithDisconnectHandler(func(ctx context.Context, sess ngrok.Session, err error) {
// Unexported error :(
// https://github.com/ngrok/ngrok-go/blob/3f355c800a49d5ef5582b00b1f36b5d5db1c4f7b/errors.go#L9-L15
switch {
case err != nil && strings.Contains(err.Error(), "ERR_NGROK_108"):
log.Printf("too many sessions error, giving up")
sess.Close()
}
}),
)
The underlying session in the library basically tries to be resilient to all sorts of errors, quietly reconnecting and so on.
This behavior especially makes sense after the first connection is established, but for initial session creation, it does feel pretty unintuitive that it just spins there, trying to connect, while the caller waits.
from ngrok-go.
I got it, the call probably would finish when the other session is terminated. I'll use your snippet then. Thanks
from ngrok-go.
Related Issues (20)
- How to define a callback to the ngrok-go/1.1.0 agent to implement dashboard STOP HOT 4
- Library errors out when auth token has whitespace / newlines HOT 1
- Implement `error_code` for RPC errors
- Update release process to take its cue from the VERSION file
- How to skip warning screen HOT 2
- Handle proxy-protocol correctly with respect to TLS backends
- Support Host header rewriting HOT 1
- Support `WithAppProtocol` for HTTP and Labeled listeners
- Cannot create tunnel HOT 3
- panic: send on closed channel, from dride.io
- can not get tunnel name HOT 1
- Add code style guidelines to CONTRIBUTING.md
- Support slog
- Fasthttp example HOT 1
- Request: Documentation on How to use ngrok with Gin and Echo frameworks HOT 1
- Integrate Rails 7 HOT 1
- Not clear in documentation how to achieve the same functionality of `ngrok tls --terminate-at edge` HOT 4
- How to specify a port to tunnel to HOT 1
- basic-auth is always asking for password HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngrok-go.