New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@signalk/client

Package Overview
Dependencies
Maintainers
6
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@signalk/client - npm Package Compare versions

Comparing version 2.0.0 to 2.0.2

12

dist/lib/api.js

@@ -33,3 +33,3 @@ "use strict";

if (path.charAt(0) !== '/') {
path = `/${path}`;
path = "/".concat(path);
}

@@ -50,3 +50,3 @@

if (path.charAt(0) !== '/') {
path = `/${path}`;
path = "/".concat(path);
}

@@ -117,3 +117,3 @@

return this.connection.fetch(`/vessels/self${path}`);
return this.connection.fetch("/vessels/self".concat(path));
}

@@ -126,3 +126,3 @@

return this.connection.fetch(`/vessels/${mrn}${path}`);
return this.connection.fetch("/vessels/".concat(mrn).concat(path));
}

@@ -142,6 +142,6 @@

if (vessel === 'self') {
return this.self(`/${group}${path}`);
return this.self("/".concat(group).concat(path));
}
return this.vessel(vessel, `/${group}${path}`);
return this.vessel(vessel, "/".concat(group).concat(path));
}

@@ -148,0 +148,0 @@

@@ -8,2 +8,4 @@ "use strict";

require("core-js/modules/es6.symbol");
require("core-js/modules/es6.regexp.replace");

@@ -112,3 +114,3 @@

let expiration = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '1y';
return this.connection.fetch(`/security/access/requests/${uuid}/${permissions === 'denied' ? 'denied' : 'approved'}`, {
return this.connection.fetch("/security/access/requests/".concat(uuid, "/").concat(permissions === 'denied' ? 'denied' : 'approved'), {
method: 'PUT',

@@ -143,3 +145,3 @@ mode: 'cors',

this.emit('error', new Error(`Error authenticating: status ${response.statusCode}`));
this.emit('error', new Error("Error authenticating: status ".concat(response.statusCode)));
});

@@ -154,3 +156,3 @@ request.send();

this.requests[name] = new _request.default(this.connection, name, body);
debug(`Registered request "${name}" with ID ${this.requests[name].getRequestId()}`);
debug("Registered request \"".concat(name, "\" with ID ").concat(this.requests[name].getRequestId()));
}

@@ -179,2 +181,13 @@

debug("Connected. ".concat(Object.keys(this.subscriptions).length === 0 ? '' : 'Resubscribing'));
Object.keys(this.subscriptions).forEach(name => {
if (name === NOTIFICATIONS_SUBSCRIPTION) {
return;
}
debug("Re-subscribing: ".concat(name));
const sub = this.subscriptions[name].getSubscriptionData();
this.unsubscribe(name, false);
this.subscribe(sub.options, name);
});
this.emit('connect');

@@ -277,2 +290,3 @@ resolve(this.connection);

if (this.connection === null) {
debug('Can\'t subscribe: no connections');
return Promise.reject(new Error('There are no available connections. Please connect before subscribe.'));

@@ -286,6 +300,7 @@ }

if (this.subscriptions.hasOwnProperty(name) && this.subscriptions[name]) {
debug('Can\'t subscribe: subscription exists');
return Promise.resolve(this.subscriptions[name]);
}
this.subscriptions[name] = new _subscription.default(this.connection, this.api, options, identifier);
this.subscriptions[name] = new _subscription.default(this.connection, this.api, options, name);
this.subscriptions[name].on('unsubscribe', () => this.emit('unsubscribe'));

@@ -298,10 +313,16 @@ this.subscriptions[name].on('subscribe', () => this.emit('subscribe', this.subscriptions[name]));

unsubscribe() {
if (this.subscriptions.hasOwnProperty(SUBSCRIPTION_NAME) && this.subscriptions[SUBSCRIPTION_NAME]) {
this.subscriptions[SUBSCRIPTION_NAME].unsubscribe();
this.subscriptions[SUBSCRIPTION_NAME] = null;
delete this.subscriptions[SUBSCRIPTION_NAME];
this.removeAllListeners('subscribe');
this.removeAllListeners('unsubscribe');
this.removeAllListeners('delta');
unsubscribe(name) {
let removelisteners = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
name = name || SUBSCRIPTION_NAME;
if (this.subscriptions.hasOwnProperty(name) && this.subscriptions[name]) {
this.subscriptions[name].unsubscribe();
this.subscriptions[name] = null;
delete this.subscriptions[name];
if (removelisteners === true) {
this.removeAllListeners('subscribe');
this.removeAllListeners('unsubscribe');
this.removeAllListeners('delta');
}
}

@@ -326,7 +347,7 @@ }

debug(`[subscribeToNotifications] emitting initial notification: ${JSON.stringify(notification, null, 2)}`);
debug("[subscribeToNotifications] emitting initial notification: ".concat(JSON.stringify(notification, null, 2)));
this.emit('notification', notification);
});
}).catch(err => {
debug(`[subscribeToNotifications] error getting initial notifications: ${err.message}`);
debug("[subscribeToNotifications] error getting initial notifications: ".concat(err.message));
});

@@ -380,3 +401,3 @@

debug(`[subscribeToNotifications] emitting notification: ${JSON.stringify(notification, null, 2)}`);
debug("[subscribeToNotifications] emitting notification: ".concat(JSON.stringify(notification, null, 2)));
this.emit('notification', notification);

@@ -399,3 +420,3 @@ }

const evaluateLeaf = key => {
currentPath += `${currentPath === '' ? '' : '.'}${key}`;
currentPath += "".concat(currentPath === '' ? '' : '.').concat(key);
cursor = cursor[key];

@@ -402,0 +423,0 @@

@@ -8,2 +8,4 @@ "use strict";

require("core-js/modules/es6.symbol");
require("core-js/modules/web.dom.iterable");

@@ -83,5 +85,5 @@

buildURI(protocol) {
let uri = this.options.useTLS === true ? `${protocol}s://` : `${protocol}://`;
let uri = this.options.useTLS === true ? "".concat(protocol, "s://") : "".concat(protocol, "://");
uri += this.options.hostname;
uri += this.options.port === 80 ? '' : `:${this.options.port}`;
uri += this.options.port === 80 ? '' : ":".concat(this.options.port);
uri += '/signalk/';

@@ -146,3 +148,3 @@ uri += this.options.version;

debug(`[reconnect] socket is ${this.socket === null ? '' : 'not '}NULL`);
debug("[reconnect] socket is ".concat(this.socket === null ? '' : 'not ', "NULL"));
this._fetchReady = false;

@@ -168,8 +170,8 @@ this.shouldDisconnect = false;

};
this.fetch('/auth/login', authRequest).then(result => {
return this.fetch('/auth/login', authRequest).then(result => {
if (!result || typeof result !== 'object' || !result.hasOwnProperty('token')) {
throw new Error(`Unexpected response from auth endpoint: ${JSON.stringify(result)}`);
throw new Error("Unexpected response from auth endpoint: ".concat(JSON.stringify(result)));
}
debug(`[reconnect] successful auth request: ${JSON.stringify(result, null, 2)}`);
debug("[reconnect] successful auth request: ".concat(JSON.stringify(result, null, 2)));
this._authenticated = true;

@@ -184,5 +186,7 @@ this._token = {

}).catch(err => {
debug("[reconnect] error logging in: ".concat(err.message, ", reconnecting"));
this.emit('error', err);
debug(`[reconnect] error logging in: ${err.message}`);
throw err;
this._retries += 1;
this.isConnecting = false;
return this.reconnect();
});

@@ -211,3 +215,3 @@ }

cleanupListeners() {
debug(`[cleanupListeners] resetting auth and removing listeners`); // Reset authentication
debug("[cleanupListeners] resetting auth and removing listeners"); // Reset authentication

@@ -231,3 +235,3 @@ this._authenticated = false;

} catch (e) {
console.log(`[Connection: ${this.options.hostname}] Error parsing data: ${e.message}`);
console.log("[Connection: ".concat(this.options.hostname, "] Error parsing data: ").concat(e.message));
}

@@ -279,3 +283,3 @@

} catch (e) {
debug(`[send] data is string but not valid JSON: ${e.message}`);
debug("[send] data is string but not valid JSON: ".concat(e.message));
}

@@ -299,3 +303,3 @@ }

debug(`Sending data to socket: ${data}`);
debug("Sending data to socket: ".concat(data));
this.socket.send(data);

@@ -306,3 +310,3 @@ }

if (path.charAt(0) !== '/') {
path = `/${path}`;
path = "/".concat(path);
}

@@ -325,10 +329,10 @@

opts.headers = _objectSpread({}, opts.headers, {
Authorization: `${this._token.kind} ${this._token.token}`
Authorization: "".concat(this._token.kind, " ").concat(this._token.token)
});
opts.credentials = 'same-origin';
opts.mode = 'cors';
debug(`[fetch] enriching fetch options with in-memory token`);
debug("[fetch] enriching fetch options with in-memory token");
}
let URI = `${this.httpURI}${path}`; // @TODO httpURI includes /api, which is not desirable. Need to refactor
let URI = "".concat(this.httpURI).concat(path); // @TODO httpURI includes /api, which is not desirable. Need to refactor

@@ -349,6 +353,6 @@ if (URI.includes('/api/auth/login')) {

debug(`[fetch] ${opts.method || 'GET'} ${URI} ${JSON.stringify(opts, null, 2)}`);
debug("[fetch] ".concat(opts.method || 'GET', " ").concat(URI, " ").concat(JSON.stringify(opts, null, 2)));
return (0, _crossFetch.default)(URI, opts).then(response => {
if (!response.ok) {
throw new Error(`Error fetching ${URI}: ${response.status} ${response.statusText}`);
throw new Error("Error fetching ".concat(URI, ": ").concat(response.status, " ").concat(response.statusText));
}

@@ -355,0 +359,0 @@

@@ -8,2 +8,4 @@ "use strict";

require("core-js/modules/es6.symbol");
require("core-js/modules/web.dom.iterable");

@@ -10,0 +12,0 @@

@@ -8,2 +8,4 @@ "use strict";

require("core-js/modules/es6.symbol");
require("core-js/modules/web.dom.iterable");

@@ -46,3 +48,3 @@

};
debug(`Sending query: ${JSON.stringify(request, null, 2)}`);
debug("Sending query: ".concat(JSON.stringify(request, null, 2)));
this.connection.send(request);

@@ -60,3 +62,3 @@ }

debug(`Sending request: ${JSON.stringify(request, null, 2)}`);
debug("Sending request: ".concat(JSON.stringify(request, null, 2)));
this.connection.send(request);

@@ -66,3 +68,3 @@ }

addResponse(response) {
debug(`Got response for request "${this.name}": ${JSON.stringify(response, null, 2)}`);
debug("Got response for request \"".concat(this.name, "\": ").concat(JSON.stringify(response, null, 2)));
const receivedAt = new Date().toISOString();

@@ -69,0 +71,0 @@ this.responses.push({

@@ -8,2 +8,4 @@ "use strict";

require("core-js/modules/es6.symbol");
require("core-js/modules/web.dom.iterable");

@@ -22,2 +24,3 @@

let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
let identifier = arguments.length > 3 ? arguments[3] : undefined;
super();

@@ -30,2 +33,3 @@ this.connection = connection;

this.identifier = identifier;
this.options = _objectSpread({

@@ -39,2 +43,9 @@ context: '*',

getSubscriptionData() {
return Object.assign({}, {
options: this.options,
identifier: this.identifier
});
}
subscribe() {

@@ -41,0 +52,0 @@ const subscription = {

{
"name": "@signalk/client",
"version": "2.0.0",
"version": "2.0.2",
"description": "A Javascript SDK for Signal K clients. Provides various abstract interfaces for discovering (via optional mDNS) the Signal K server and communication via WebSocket & REST. Aims to implement all major APIs in the most recent Signal K version(s)",

@@ -10,3 +10,5 @@ "main": "index.js",

"dist": "./node_modules/.bin/babel src -d dist",
"prepublishOnly": "./node_modules/.bin/babel src -d dist",
"prepublishOnly": "npm run dist",
"preversion": "npm test",
"postversion": "npm run push && git add --all . && git commit -am 'Version bump' && git push && git push --tags",
"push": "npm publish --access public --scope @signalk ."

@@ -58,6 +60,7 @@ },

"core-js": "^2.6.5",
"cross-fetch": "^2.1.1",
"cross-fetch": "^3.0.3",
"debug": "^4.1.1",
"eventemitter3": "^3.0.1",
"isomorphic-ws": "^4.0.0",
"mqtt-packet": "^5.6.1",
"uuid": "^3.3.2",

@@ -64,0 +67,0 @@ "ws": "^7.0.0"

@@ -159,2 +159,16 @@ /**

}
debug(`Connected. ${Object.keys(this.subscriptions).length === 0 ? '' : 'Resubscribing'}`)
Object.keys(this.subscriptions).forEach(name => {
if (name === NOTIFICATIONS_SUBSCRIPTION) {
return
}
debug(`Re-subscribing: ${name}`)
const sub = this.subscriptions[name].getSubscriptionData()
this.unsubscribe(name, false)
this.subscribe(sub.options, name)
})
this.emit('connect')

@@ -258,2 +272,3 @@ resolve(this.connection)

if (this.connection === null) {
debug('Can\'t subscribe: no connections')
return Promise.reject(new Error('There are no available connections. Please connect before subscribe.'))

@@ -267,6 +282,7 @@ }

if (this.subscriptions.hasOwnProperty(name) && this.subscriptions[name]) {
debug('Can\'t subscribe: subscription exists')
return Promise.resolve(this.subscriptions[name])
}
this.subscriptions[name] = new Subscription(this.connection, this.api, options, identifier)
this.subscriptions[name] = new Subscription(this.connection, this.api, options, name)
this.subscriptions[name].on('unsubscribe', () => this.emit('unsubscribe'))

@@ -280,10 +296,14 @@ this.subscriptions[name].on('subscribe', () => this.emit('subscribe', this.subscriptions[name]))

unsubscribe () {
if (this.subscriptions.hasOwnProperty(SUBSCRIPTION_NAME) && this.subscriptions[SUBSCRIPTION_NAME]) {
this.subscriptions[SUBSCRIPTION_NAME].unsubscribe()
this.subscriptions[SUBSCRIPTION_NAME] = null
delete this.subscriptions[SUBSCRIPTION_NAME]
this.removeAllListeners('subscribe')
this.removeAllListeners('unsubscribe')
this.removeAllListeners('delta')
unsubscribe (name, removelisteners = true) {
name = name || SUBSCRIPTION_NAME
if (this.subscriptions.hasOwnProperty(name) && this.subscriptions[name]) {
this.subscriptions[name].unsubscribe()
this.subscriptions[name] = null
delete this.subscriptions[name]
if (removelisteners === true) {
this.removeAllListeners('subscribe')
this.removeAllListeners('unsubscribe')
this.removeAllListeners('delta')
}
}

@@ -290,0 +310,0 @@ }

@@ -159,3 +159,3 @@ /**

this.fetch('/auth/login', authRequest)
return this.fetch('/auth/login', authRequest)
.then(result => {

@@ -179,5 +179,7 @@ if (!result || typeof result !== 'object' || !result.hasOwnProperty('token')) {

.catch(err => {
debug(`[reconnect] error logging in: ${err.message}, reconnecting`)
this.emit('error', err)
debug(`[reconnect] error logging in: ${err.message}`)
throw err
this._retries += 1
this.isConnecting = false
return this.reconnect()
})

@@ -184,0 +186,0 @@ }

@@ -13,3 +13,3 @@ /**

export default class Subscription extends EventEmitter {
constructor (connection, api, options = {}) {
constructor (connection, api, options = {}, identifier) {
super()

@@ -21,2 +21,3 @@ this.connection = connection

this.identifier = identifier
this.options = {

@@ -29,2 +30,9 @@ context: '*',

getSubscriptionData () {
return Object.assign({}, {
options: this.options,
identifier: this.identifier
})
}
subscribe () {

@@ -31,0 +39,0 @@ const subscription = {

@@ -9,3 +9,2 @@ /**

import mdns from 'mdns'
import Client, {

@@ -16,2 +15,4 @@ Discovery,

} from '../src'
import mdns from 'mdns'
import { assert } from 'chai'

@@ -43,2 +44,5 @@ import { v4 as uuid } from 'uuid'

const PASSWORD = 'signalk'
let TEST_SERVER_HOSTNAME = process.env.TEST_SERVER_HOSTNAME
let TEST_SERVER_PORT = process.env.TEST_SERVER_PORT
let serverApp

@@ -48,11 +52,8 @@ const securityConfig = {

expiration: '1d',
secretKey:
'3c2eddf95ece9080518eb777b26c0fa6285f107cccb5ff9d5bdd7776eeb82c8afaf0dffa7d9312936882351ec6b1d5535203b4a2b806ab130cdbcd917f46f2a69e7ff4548ca3644c97a98185284041de46518cdb026f85430532fa4482882e4cfd08cc0256dca88d0ca2577b91d6a435a832e6c600b2db13f794d087e5e3a181d9566c1e61a14f984dbc643a7f6ab6a60cafafff34c93475d442475136cf7f0bfb62c59b050a9be572bc26993c46ef05fa748dc8395277eaa07519d79a7bc12502a2429b2f89b78796f6dcf3f474a5c5e276ecbb59dcdceaa8df8f1b1f98ec23a4c36cc1334e07e06a8c8cd6671fee599e578d24aabd187d1a2903ae6facb090',
users: [
{
username: 'sdk',
type: 'admin',
password: '$2a$10$JyzSM5PMD3PCyivdtSN61OfwmjfgdISVtJ1l5KIC8/R1sUHPseMU2'
}
],
secretKey: '3c2eddf95ece9080518eb777b26c0fa6285f107cccb5ff9d5bdd7776eeb82c8afaf0dffa7d9312936882351ec6b1d5535203b4a2b806ab130cdbcd917f46f2a69e7ff4548ca3644c97a98185284041de46518cdb026f85430532fa4482882e4cfd08cc0256dca88d0ca2577b91d6a435a832e6c600b2db13f794d087e5e3a181d9566c1e61a14f984dbc643a7f6ab6a60cafafff34c93475d442475136cf7f0bfb62c59b050a9be572bc26993c46ef05fa748dc8395277eaa07519d79a7bc12502a2429b2f89b78796f6dcf3f474a5c5e276ecbb59dcdceaa8df8f1b1f98ec23a4c36cc1334e07e06a8c8cd6671fee599e578d24aabd187d1a2903ae6facb090',
users: [{
username: 'sdk',
type: 'admin',
password: '$2a$10$JyzSM5PMD3PCyivdtSN61OfwmjfgdISVtJ1l5KIC8/R1sUHPseMU2'
}],
devices: [],

@@ -65,5 +66,41 @@ immutableConfig: false,

let TEST_SERVER_HOSTNAME = process.env.TEST_SERVER_HOSTNAME
let TEST_SERVER_PORT = process.env.TEST_SERVER_PORT || 80
function startServer (done = () => {}) {
TEST_SERVER_HOSTNAME = 'localhost'
let promise
if (!TEST_SERVER_PORT) {
promise = freeport()
} else {
promise = Promise.resolve(TEST_SERVER_PORT)
}
promise.then(port => {
TEST_SERVER_PORT = port
serverApp = new Server({
config: {
settings: {
port,
interfaces: {
plugins: false
},
security: {
strategy: './tokensecurity'
}
}
},
securityConfig: securityConfig
})
serverApp.start().then(() => done())
})
}
function killServer (done = () => {}) {
if (!serverApp) {
return done()
}
serverApp.stop().then(() => done())
}
describe('Signal K SDK', () => {

@@ -74,20 +111,5 @@ before(done => {

} else {
TEST_SERVER_HOSTNAME = 'localhost'
freeport().then(port => {
TEST_SERVER_PORT = port
const serverApp = new Server({
config: {
settings: {
port,
interfaces: {
plugins: false
},
security: {
strategy: './tokensecurity'
}
}
},
securityConfig: securityConfig
})
serverApp.start().then(() => done())
startServer(() => {
console.log('STARTED SERVER')
done()
})

@@ -132,2 +154,3 @@ }

/*
it('... receives an access request sent by some device', done => {

@@ -142,3 +165,3 @@ let isDone = false

username: USER,
password: 'signalk',
password: PASSWORD,
reconnect: false,

@@ -169,2 +192,3 @@ notifications: true,

}).timeout(30000)
// */

@@ -180,3 +204,3 @@ it('... can respond to the access request notification sent by server', done => {

username: USER,
password: 'signalk',
password: PASSWORD,
reconnect: false,

@@ -217,3 +241,3 @@ notifications: true,

})
describe('On-demand authentication using request/response dynamics', () => {

@@ -300,3 +324,3 @@ it('... sends an authentication request with incorrect password, and receives the proper error code', done => {

username: USER,
password: 'signalk',
password: PASSWORD,
reconnect: false,

@@ -353,3 +377,3 @@ notifications: false,

username: USER,
password: 'signalk'
password: PASSWORD
}

@@ -413,3 +437,3 @@ })

})
describe('Subscriptions', () => {

@@ -537,3 +561,3 @@ it('... Creates a subscription for navigation data', done => {

username: USER,
password: 'signalk',
password: PASSWORD,
bearerTokenPrefix: 'JWT'

@@ -564,3 +588,3 @@ })

username: USER,
password: 'signalk',
password: PASSWORD,
useTLS: false,

@@ -872,2 +896,31 @@ reconnect: false,

describe('Module API', () => {
it('... exports a Signal K Client as a named constant and the default export', done => {
assert(Client === NamedClient)
done()
})
it('... successfully instantiates a Client with default options', done => {
const client = new Client()
assert(client.options.hostname === 'localhost')
assert(client.options.port === 3000)
assert(client.options.useTLS === true)
assert(client.options.version === 'v1')
assert(client.options.autoConnect === false)
done()
})
it('... instantiates a Client with custom options', done => {
const client = new Client({ hostname: 'signalk.org' })
assert(client.options.hostname === 'signalk.org')
done()
})
it('... Client is an EventEmitter', done => {
const client = new Client()
assert(typeof client.on === 'function')
done()
})
})
describe('Connection', () => {

@@ -1062,3 +1115,3 @@ it('... Successfully closes the connection and any connection attempts when "disconnect" is called', done => {

username: USER,
password: 'signalk',
password: PASSWORD,
reconnect: false,

@@ -1087,32 +1140,86 @@ notifications: false,

// */
})
describe('Module API', () => {
it('... exports a Signal K Client as a named constant and the default export', done => {
assert(Client === NamedClient)
done()
})
it('... Successfully re-connects after the remote server is restarted', done => {
const client = new Client({
hostname: TEST_SERVER_HOSTNAME,
port: TEST_SERVER_PORT,
useTLS: false,
useAuthentication: true,
username: USER,
password: PASSWORD,
reconnect: true,
notifications: false,
bearerTokenPrefix: 'JWT',
maxRetries: Infinity
})
it('... successfully instantiates a Client with default options', done => {
const client = new Client()
assert(client.options.hostname === 'localhost')
assert(client.options.port === 3000)
assert(client.options.useTLS === true)
assert(client.options.version === 'v1')
assert(client.options.autoConnect === false)
done()
})
let connectionCount = 0
it('... instantiates a Client with custom options', done => {
const client = new Client({ hostname: 'signalk.org' })
assert(client.options.hostname === 'signalk.org')
done()
})
client.on('connect', () => {
connectionCount += 1
if (connectionCount === 1) {
killServer(() => setTimeout(() => {
startServer()
}, 100))
}
it('... Client is an EventEmitter', done => {
const client = new Client()
assert(typeof client.on === 'function')
done()
})
if (connectionCount === 2) {
done()
}
})
client.connect()
}).timeout(15000)
/*
// @NOTE:
// this test requires a manual restart of the test server,
// as the included server doesn't emit deltas
it('... Successfully re-subscribes to all data after the remote server is restarted', done => {
const client = new Client({
hostname: 'hq.decipher.digital',
port: 3000,
useTLS: false,
useAuthentication: false,
reconnect: true,
notifications: false,
bearerTokenPrefix: 'JWT',
maxRetries: Infinity
})
let connectionCount = 0
let serverKilled = false
let deltas = 0
let doneCalled = false
client.on('delta', data => {
if (!data || typeof data !== 'object' || !data.hasOwnProperty('updates') || serverKilled === true) {
return
}
deltas += 1
if (connectionCount > 1 && doneCalled === false) {
doneCalled = true
assert(deltas >= 1000)
done(deltas >= 1000 ? null : new Error('Didn\'t get deltas after reconnection'))
}
})
client.on('connect', () => {
connectionCount += 1
if (connectionCount === 1) {
client.subscribe()
}
if (connectionCount > 1) {
deltas = 1000
}
})
client.connect()
}).timeout(150000)
// */
})
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc