Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this[$token] = opts.token;
// Editable options
const secure = opts.secure === undefined ? defaults.secure : opts.secure;
this.bufferSize = bufferSizeConfig;
this.port = opts.port || (secure ? defaults.portSecure : defaults.port);
this.flatten = opts.flatten;
this.flattenArrays = 'flattenArrays' in opts ? opts.flattenArrays : opts.flatten;
this.json = opts.json;
this.host = opts.host;
this.console = opts.console;
this.minLevel = opts.minLevel;
this.replacer = opts.replacer;
this.inactivityTimeout = opts.inactivityTimeout || defaults.inactivityTimeout;
this.timestamp = opts.timestamp;
this.withLevel = 'withLevel' in opts ? opts.withLevel : true;
this.withStack = opts.withStack;
this[$secure] = secure;
this[$reconnectInitialDelay] = opts.reconnectInitialDelay || defaults.reconnectInitialDelay;
this[$reconnectMaxDelay] = opts.reconnectMaxDelay || defaults.reconnectMaxDelay;
this[$reconnectBackoffStrategy] = opts.reconnectBackoffStrategy || defaults.reconnectBackoffStrategy;
this.debugEnabled = opts.debug || false;
if (!this.debugEnabled) {
//if there is no debug set, empty logger should be used
this.debugLogger = { log: () => { } };
} else {
this.debugLogger = (opts.debugLogger && opts.debugLogger.log) ? opts.debugLogger : defaults.debugLogger;
}
this[$reconnect] = reconnect_core(function () {
set inactivityTimeout(val) {
if (Number.isInteger(val) && val >= 0) {
this[$timeout] = parseInt(val);
}
if (!_.isNumber(this[$timeout])) {
this[$timeout] = defaults.inactivityTimeout;
}
}