Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

the client reconnection is not documented #392

Closed
ivanhuay opened this issue Oct 14, 2016 · 7 comments
Closed

the client reconnection is not documented #392

ivanhuay opened this issue Oct 14, 2016 · 7 comments
Labels

Comments

@ivanhuay
Copy link

I was having some problems connecting to a balanced ldap and reading the code I found the solution undocumented.

var client = ldap.createClient({
        url: config.ldap.url,
        reconnect:true
});
@ivanhuay
Copy link
Author

with this option can reconnect but not rebind. I 'm working to figure out how to do a rebind after client reconnect.

@strebl
Copy link

strebl commented Dec 9, 2016

@ivanhuay Did you find a solution for your problem?

@ivanhuay
Copy link
Author

@strebl Not for the moment I check the results of the query and based on that I make a rebind or not

@liyuntao
Copy link

liyuntao commented Jun 16, 2017

A little late, maybe. For others enter this issue later:

    // e.g. in your client's class constructor
    
    this.ldapClient = ldap.createClient({
        url: ldap_url,
        reconnect: {
            initialDelay: 100,
            maxDelay: 1000,
            failAfter: 10
        }
    });

    const client = this.ldapClient;
    // do a rebind when reconnect
    this.ldapClient.on('connect', function () {
        client.bind(ldap_user, ldap_pwd, err => {
            if (err) {
                logger.error('error while ldap binding' + err);
            }
        });
    });

@johno1985
Copy link

A little late, maybe. For others enter this issue later:

    // e.g. in your client's class constructor
    
    this.ldapClient = ldap.createClient({
        url: ldap_url,
        reconnect: {
            initialDelay: 100,
            maxDelay: 1000,
            failAfter: 10
        }
    });

    const client = this.ldapClient;
    // do a rebind when reconnect
    this.ldapClient.on('connect', function () {
        client.bind(ldap_user, ldap_pwd, err => {
            if (err) {
                logger.error('error while ldap binding' + err);
            }
        });
    });

Will this cause bind to execute twice on the first connect?

@yunnysunny
Copy link

A little late, maybe. For others enter this issue later:

    // e.g. in your client's class constructor
    
    this.ldapClient = ldap.createClient({
        url: ldap_url,
        reconnect: {
            initialDelay: 100,
            maxDelay: 1000,
            failAfter: 10
        }
    });

    const client = this.ldapClient;
    // do a rebind when reconnect
    this.ldapClient.on('connect', function () {
        client.bind(ldap_user, ldap_pwd, err => {
            if (err) {
                logger.error('error while ldap binding' + err);
            }
        });
    });

I found the client not trigger connect event even if I set reconnect parameter to true occasionally.

@jsumners
Copy link
Member

⚠️ This issue has been locked due to age. If you have encountered a recent
problem that seems to be covered by this issue, please open a new issue.

Please include a minimal reproducible example
when opening a new issue.

@ldapjs ldapjs locked as resolved and limited conversation to collaborators Mar 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants