amqp-node / amqplib

AMQP 0-9-1 library and client for Node.JS

Home Page:https://amqp-node.github.io/amqplib/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

var timeout = sockopts.timeout;
but there is no mention of this parameter in the doc or in the typescript definition.

Is this timeout option working? Is it just forgotten or consciously omitted in the doc?

Hi @francois-spectre,

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