client referral docs

This commit is contained in:
Mark Cavage 2011-09-27 13:18:07 -07:00
parent 7ceea2b853
commit 25f9da2e5d
1 changed files with 11 additions and 7 deletions

View File

@ -206,13 +206,14 @@ fields:
||timeLimit||the maximum amount of time the server should take in responding, in seconds. Defaults to 10. Lots of servers will ignore this.|| ||timeLimit||the maximum amount of time the server should take in responding, in seconds. Defaults to 10. Lots of servers will ignore this.||
Responses from the `search` method are an `EventEmitter` where you will get a Responses from the `search` method are an `EventEmitter` where you will get a
notification for each search entry that comes back from the server. You will notification for each `searchEntry` that comes back from the server. You will
additionally be able to listen for an `error` and `end` event. Note that the additionally be able to listen for a `searchReference`, `error` and `end` event.
`error` event will only be for client/TCP errors, not LDAP error codes like the Note that the `error` event will only be for client/TCP errors, not LDAP error
other APIs. You'll want to check the LDAP status code (likely for `0`) on the codes like the other APIs. You'll want to check the LDAP status code
`end` event to assert success. LDAP search results can give you a lot of status (likely for `0`) on the `end` event to assert success. LDAP search results
codes, such as time or size exceeded, busy, inappropriate matching, etc., can give you a lot of status codes, such as time or size exceeded, busy,
which is why this method doesn't try to wrap up the code matching. inappropriate matching, etc., which is why this method doesn't try to wrap up
the code matching.
Example: Example:
@ -227,6 +228,9 @@ Example:
res.on('searchEntry', function(entry) { res.on('searchEntry', function(entry) {
console.log('entry: ' + JSON.stringify(entry.object)); console.log('entry: ' + JSON.stringify(entry.object));
}); });
res.on('searchReference', function(referral) {
console.log('referral: ' + referral.uris.join());
});
res.on('error', function(err) { res.on('error', function(err) {
console.error('error: ' + err.message); console.error('error: ' + err.message);
}); });