Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

socketcluster-client

Package Overview
Dependencies
Maintainers
1
Versions
236
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

socketcluster-client - npm Package Compare versions

Comparing version 18.2.2 to 18.3.0

46

lib/clientsocket.js

@@ -20,4 +20,2 @@ const StreamDemux = require('stream-demux');

const isBrowser = typeof window !== 'undefined';
function AGClientSocket(socketOptions) {

@@ -74,3 +72,2 @@ AsyncStreamEmitter.call(

this.channelPrefix = opts.channelPrefix || null;
this.disconnectOnUnload = opts.disconnectOnUnload == null ? true : opts.disconnectOnUnload;
this.authTokenName = opts.authTokenName;

@@ -187,6 +184,2 @@

if (isBrowser && this.disconnectOnUnload && typeof addEventListener !== 'undefined' && typeof removeEventListener !== 'undefined') {
this._handleBrowserUnload();
}
if (this.options.autoConnect) {

@@ -228,41 +221,2 @@ this.connect();

AGClientSocket.prototype._handleBrowserUnload = async function () {
let unloadHandler = () => {
this.disconnect();
};
let isUnloadHandlerAttached = false;
let attachUnloadHandler = () => {
if (!isUnloadHandlerAttached) {
isUnloadHandlerAttached = true;
addEventListener('beforeunload', unloadHandler, false);
}
};
let detachUnloadHandler = () => {
if (isUnloadHandlerAttached) {
isUnloadHandlerAttached = false;
removeEventListener('beforeunload', unloadHandler, false);
}
};
(async () => {
let consumer = this.listener('connecting').createConsumer();
while (true) {
let packet = await consumer.next();
if (packet.done) break;
attachUnloadHandler();
}
})();
(async () => {
let consumer = this.listener('close').createConsumer();
while (true) {
let packet = await consumer.next();
if (packet.done) break;
detachUnloadHandler();
}
})();
};
AGClientSocket.prototype._setAuthToken = function (data) {

@@ -269,0 +223,0 @@ this._changeToAuthenticatedState(data.token);

2

package.json
{
"name": "socketcluster-client",
"description": "SocketCluster JavaScript client",
"version": "18.2.2",
"version": "18.3.0",
"homepage": "https://socketcluster.io/",

@@ -6,0 +6,0 @@ "contributors": [

@@ -161,3 +161,2 @@ SocketCluster JavaScript client

channelPrefix: null,
disconnectOnUnload: true,
autoReconnectOptions: {

@@ -164,0 +163,0 @@ initialDelay: 10000, //milliseconds

Sorry, the diff of this file is too big to display

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