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

@bloks/link-session-manager

Package Overview
Dependencies
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bloks/link-session-manager - npm Package Compare versions

Comparing version 0.2.647 to 0.2.648

2

lib/index.d.ts
/**
* proton-link-session-manager v0.2.647
* proton-link-session-manager v0.2.648
* https://github.com/greymass/proton-link-session-manager

@@ -4,0 +4,0 @@ *

/**
* proton-link-session-manager v0.2.647
* proton-link-session-manager v0.2.648
* https://github.com/greymass/proton-link-session-manager

@@ -107,5 +107,4 @@ *

var RobustWebSocket = /** @class */ (function () {
function RobustWebSocket(url, userOptions) {
function RobustWebSocket(url, opts) {
var _this = this;
if (userOptions === void 0) { userOptions = {}; }
this.attempts = 0;

@@ -144,3 +143,3 @@ this.reconnects = -1;

this.url = url;
this.opts = Object.assign({}, this.opts, typeof userOptions === 'function' ? { shouldReconnect: userOptions } : userOptions);
this.opts = Object.assign({}, this.opts, opts);
if (typeof this.opts.timeout !== 'number') {

@@ -174,7 +173,6 @@ throw new Error('timeout must be the number of milliseconds to timeout a connection attempt');

var _this = this;
// New websocket
var newUrl = typeof url === 'function' ? url(this) : url;
console.log('Creating new websocket to', newUrl);
console.log('Creating new websocket to', url);
var isReconnecting = this.url === url && !!this.realWs;
this.pendingReconnect = undefined;
this.realWs = new WebSocket(newUrl);
this.realWs = new WebSocket(url);
this.realWs.binaryType = this.binaryType;

@@ -196,29 +194,31 @@ this.attempts++;

}, this.opts.timeout);
var _loop_1 = function (stdEvent) {
var onEvent = function (event) {
_this.dispatchEvent(event);
var cb = _this['on' + stdEvent];
if (typeof cb === 'function') {
return cb(event);
}
if (!isReconnecting) {
var _loop_1 = function (stdEvent) {
var onEvent = function (event) {
_this.dispatchEvent(event);
var cb = _this['on' + stdEvent];
if (typeof cb === 'function') {
return cb(event);
}
};
this_1.realWs.addEventListener(stdEvent, onEvent);
};
this_1.realWs.addEventListener(stdEvent, onEvent);
};
var this_1 = this;
try {
for (var _b = tslib.__values(['open', 'close', 'message', 'error', 'ping']), _c = _b.next(); !_c.done; _c = _b.next()) {
var stdEvent = _c.value;
_loop_1(stdEvent);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
var this_1 = this;
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
for (var _b = tslib.__values(['open', 'close', 'message', 'error', 'ping']), _c = _b.next(); !_c.done; _c = _b.next()) {
var stdEvent = _c.value;
_loop_1(stdEvent);
}
}
finally { if (e_1) throw e_1.error; }
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
if (this.opts.netInfo) {
this.initializeConnectivity();
}
}
if (this.opts.netInfo) {
this.initializeConnectivity();
}
};

@@ -225,0 +225,0 @@ RobustWebSocket.prototype.clearPendingReconnectIfNeeded = function () {

/**
* proton-link-session-manager v0.2.647
* proton-link-session-manager v0.2.648
* https://github.com/greymass/proton-link-session-manager

@@ -84,3 +84,3 @@ *

class RobustWebSocket {
constructor(url, userOptions = {}) {
constructor(url, opts) {
this.attempts = 0;

@@ -119,3 +119,3 @@ this.reconnects = -1;

this.url = url;
this.opts = Object.assign({}, this.opts, typeof userOptions === 'function' ? { shouldReconnect: userOptions } : userOptions);
this.opts = Object.assign({}, this.opts, opts);
if (typeof this.opts.timeout !== 'number') {

@@ -147,7 +147,6 @@ throw new Error('timeout must be the number of milliseconds to timeout a connection attempt');

newWebSocket(url) {
// New websocket
const newUrl = typeof url === 'function' ? url(this) : url;
console.log('Creating new websocket to', newUrl);
console.log('Creating new websocket to', url);
const isReconnecting = this.url === url && !!this.realWs;
this.pendingReconnect = undefined;
this.realWs = new WebSocket(newUrl);
this.realWs = new WebSocket(url);
this.realWs.binaryType = this.binaryType;

@@ -169,15 +168,17 @@ this.attempts++;

}, this.opts.timeout);
for (const stdEvent of ['open', 'close', 'message', 'error', 'ping']) {
const onEvent = (event) => {
this.dispatchEvent(event);
const cb = this['on' + stdEvent];
if (typeof cb === 'function') {
return cb(event);
}
};
this.realWs.addEventListener(stdEvent, onEvent);
if (!isReconnecting) {
for (const stdEvent of ['open', 'close', 'message', 'error', 'ping']) {
const onEvent = (event) => {
this.dispatchEvent(event);
const cb = this['on' + stdEvent];
if (typeof cb === 'function') {
return cb(event);
}
};
this.realWs.addEventListener(stdEvent, onEvent);
}
if (this.opts.netInfo) {
this.initializeConnectivity();
}
}
if (this.opts.netInfo) {
this.initializeConnectivity();
}
}

@@ -184,0 +185,0 @@ clearPendingReconnectIfNeeded() {

{
"name": "@bloks/link-session-manager",
"description": "Session management for signature providers when receiving requests using the Anchor Link protocol",
"version": "0.2.647",
"version": "0.2.648",
"homepage": "https://github.com/greymass/proton-link-session-manager",

@@ -6,0 +6,0 @@ "license": "BSD-3-Clause",

import NetInfo, {NetInfoState, NetInfoSubscription} from '@react-native-community/netinfo'
interface Options {
timeout: number
shouldReconnect: (event: any, ws: RobustWebSocket) => number | undefined
netInfo?: typeof NetInfo
automaticOpen: boolean
handle1000: boolean
}
export default class RobustWebSocket {

@@ -20,9 +28,3 @@ realWs?: WebSocket

opts: {
timeout: number
shouldReconnect: (event: any, ws: RobustWebSocket) => number | undefined
netInfo?: typeof NetInfo
automaticOpen: boolean
handle1000: boolean
} = {
opts: Options = {
// the time to wait before a successful connection

@@ -54,10 +56,6 @@ // before the attempt is considered to have timed out

constructor(url, userOptions = {}) {
constructor(url, opts: Partial<Options>) {
this.url = url
this.opts = Object.assign(
{},
this.opts,
typeof userOptions === 'function' ? {shouldReconnect: userOptions} : userOptions
)
this.opts = Object.assign({}, this.opts, opts)

@@ -97,9 +95,9 @@ if (typeof this.opts.timeout !== 'number') {

newWebSocket(url) {
// New websocket
const newUrl = typeof url === 'function' ? url(this) : url
console.log('Creating new websocket to', newUrl)
newWebSocket(url: string) {
console.log('Creating new websocket to', url)
const isReconnecting = this.url === url && !!this.realWs
this.pendingReconnect = undefined
this.realWs = new WebSocket(newUrl)
this.realWs = new WebSocket(url)
this.realWs.binaryType = this.binaryType

@@ -125,18 +123,20 @@

for (const stdEvent of ['open', 'close', 'message', 'error', 'ping']) {
const onEvent = (event: Event) => {
this.dispatchEvent(event)
if (!isReconnecting) {
for (const stdEvent of ['open', 'close', 'message', 'error', 'ping']) {
const onEvent = (event: Event) => {
this.dispatchEvent(event)
const cb = this['on' + stdEvent]
if (typeof cb === 'function') {
return cb(event)
const cb = this['on' + stdEvent]
if (typeof cb === 'function') {
return cb(event)
}
}
this.realWs.addEventListener(stdEvent, onEvent)
}
this.realWs.addEventListener(stdEvent, onEvent)
if (this.opts.netInfo) {
this.initializeConnectivity()
}
}
if (this.opts.netInfo) {
this.initializeConnectivity()
}
}

@@ -197,3 +197,2 @@

}
}

@@ -200,0 +199,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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