node-statsd
node-statsd copied to clipboard
Client: Constructor supports createSocket option
Refs #77
This change allows clients to configure a custom createSocket method to use for socket construction. The example below shows how clients on newer versions of node, with statsd daemons running locally, could provide a socket constructor to bypass DNS lookups:
var statsd = new StatsD({
createSocket: function() {
return dgram.createSocket({
type: 'udp4',
lookup: function() {
const cb = arguments[arguments.length -1];
cb(null, '127.0.0.1', 4);
}
});
}
});
This is useful to allow