The connect's timeout option does not appear neither in the typescript definition nor in the doc
francois-spectre opened this issue · comments
We have found in the code a timeout option for the connect method
Line 98 in b364778
Is this timeout option working? Is it just forgotten or consciously omitted in the doc?
Thank you for reporting the missing documentation for the timeout option. I can confirm it does work (see below). I will update the documentation.
const amqplib = require('amqplib');
(async () => {
await amqplib.connect('amqp://localhost:5672', { timeout: 1 });
})();
Error: connect ETIMEDOUT
at Socket.<anonymous> (/Users/steve/Development/amqp-node/amqplib-705/node_modules/amqplib/lib/connect.js:178:20)
Documentation updated...
The socket options may also include the keys timeout and noDelay. timeout specifies the socket timeout in milliseconds while establishing the connection and noDelay is a boolean value that when true sets TCP_NODELAY on the underlying socket.
Thanks again for reporting