waitOnFirstConnect and timeout
See original GitHub issueHello,
I’ve been making some tests and i’m having some issue when using the waitOnFirstConnect
together with the timeout
option.
The script is waiting forever and does not seem to respect the timeout. Here is simple example script
const NATS = require("nats");
async function run() {
const nc = await NATS.connect({
servers: 'nats://localhost:4222',
waitOnFirstConnect: true,
timeout: 10000,
});
console.log('connected');
nc.closed().finally(() => {
console.log(`Connection definitely closed`);
});
}
run();
Expected: finish after 10 seconds when no nats server is running Actual: hangs forever
Am i missing something or do you think there could be a bug somewhere ?
Thank you for your help
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
NatsConnectionOptions | ts-nats
A list of server URLs where the client should attempt a connection. Optional timeout. timeout: undefined | number. Defined in ...
Read more >reconnection error with v2.0.0-213 · Issue #376 · nats-io/nats.js
I'm using version 2.0.0-213 installed by npm install nats@beta . ... After a short period of time nats.js throws an exception: (node:10288) ...
Read more >Cant use jwt connect nats by my code,its doesnt work
I want to use Nats websocket but I don't know how to get user information so I use jwt and it works but...
Read more >Authentication Timeout - NATS Docs
Authentication Timeout · If a client doesn't authenticate to the server within the specified time, the server disconnects the server to prevent abuses....
Read more >nats.ws - UNPKG
355, // by default the request times out after 1s (1000 millis) and has ... 767, | `waitOnFirstConnect` | `false` | If `true`...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That is a bug then. Will fix Monday.
@aricart Thank you very much for your time and detailed explanation !