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

backendless-rt-client

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

backendless-rt-client - npm Package Compare versions

Comparing version 0.0.10 to 0.0.11

62

es/client.js

@@ -67,2 +67,4 @@ 'use strict';

var CONNECTION_MANAGE_EVENTS = [_constants.NativeSocketEvents.CONNECTING, _constants.NativeSocketEvents.CONNECT, _constants.NativeSocketEvents.CONNECT_ERROR, _constants.NativeSocketEvents.DISCONNECT, _constants.NativeSocketEvents.RECONNECT_ATTEMPT];
var RTClient = (_dec = _utils2.default.deferred(1000), (_class = function () {

@@ -98,3 +100,3 @@ function RTClient(config) {

this.runNativeEventListeners = function (event) {
this.runSocketEventListeners = function (event) {
for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {

@@ -104,4 +106,4 @@ args[_key2 - 1] = arguments[_key2];

if (_this.nativeEvents[event]) {
_this.nativeEvents[event].forEach(function (callback) {
if (_this.socketEvents[event]) {
_this.socketEvents[event].forEach(function (callback) {
return callback.apply(undefined, args);

@@ -113,44 +115,50 @@ });

this.addConnectingEventListener = function (callback) {
return _this.addNativeEventListener(_constants.NativeSocketEvents.CONNECTING, callback);
return _this.addSocketEventListener(_constants.NativeSocketEvents.CONNECTING, callback);
};
this.removeConnectingEventListener = function (callback) {
return _this.removeNativeEventListener(_constants.NativeSocketEvents.CONNECTING, callback);
return _this.removeSocketEventListener(_constants.NativeSocketEvents.CONNECTING, callback);
};
this.addConnectEventListener = function (callback) {
return _this.addNativeEventListener(_constants.NativeSocketEvents.CONNECT, callback);
return _this.addSocketEventListener(_constants.NativeSocketEvents.CONNECT, callback);
};
this.removeConnectEventListener = function (callback) {
return _this.removeNativeEventListener(_constants.NativeSocketEvents.CONNECT, callback);
return _this.removeSocketEventListener(_constants.NativeSocketEvents.CONNECT, callback);
};
this.addConnectErrorEventListener = function (callback) {
return _this.addNativeEventListener(_constants.NativeSocketEvents.CONNECT_ERROR, callback);
return _this.addSocketEventListener(_constants.NativeSocketEvents.CONNECT_ERROR, callback);
};
this.removeConnectErrorEventListener = function (callback) {
return _this.removeNativeEventListener(_constants.NativeSocketEvents.CONNECT_ERROR, callback);
return _this.removeSocketEventListener(_constants.NativeSocketEvents.CONNECT_ERROR, callback);
};
this.addDisconnectEventListener = function (callback) {
return _this.addNativeEventListener(_constants.NativeSocketEvents.DISCONNECT, callback);
return _this.addSocketEventListener(_constants.NativeSocketEvents.DISCONNECT, callback);
};
this.removeDisconnectEventListener = function (callback) {
return _this.removeNativeEventListener(_constants.NativeSocketEvents.DISCONNECT, callback);
return _this.removeSocketEventListener(_constants.NativeSocketEvents.DISCONNECT, callback);
};
this.addReconnectAttemptEventListener = function (callback) {
return _this.addNativeEventListener(_constants.NativeSocketEvents.RECONNECT_ATTEMPT, callback);
return _this.addSocketEventListener(_constants.NativeSocketEvents.RECONNECT_ATTEMPT, callback);
};
this.removeReconnectAttemptEventListener = function (callback) {
return _this.removeNativeEventListener(_constants.NativeSocketEvents.RECONNECT_ATTEMPT, callback);
return _this.removeSocketEventListener(_constants.NativeSocketEvents.RECONNECT_ATTEMPT, callback);
};
this.removeConnectionListeners = function () {
CONNECTION_MANAGE_EVENTS.forEach(function (event) {
return _this.removeSocketEventListener(event);
});
};
this.config = new _config2.default(config);
this.nativeEvents = {};
this.socketEvents = {};

@@ -184,3 +192,3 @@ var socketContext = {

if (!this.session) {
this.session = new _session2.default(this.config, this.runNativeEventListeners, this.onSessionDisconnect);
this.session = new _session2.default(this.config, this.runSocketEventListeners, this.onSessionDisconnect);
this.session.getSocket().then(function () {

@@ -201,3 +209,3 @@ _this2.subscriptions.initialize();

value: function terminate() {
this.nativeEvents = {};
this.socketEvents = {};

@@ -220,3 +228,3 @@ this.subscriptions.reset();

this.runNativeEventListeners(_constants.NativeSocketEvents.DISCONNECT, reason || 'disconnected by client');
this.runSocketEventListeners(_constants.NativeSocketEvents.DISCONNECT, reason || 'disconnected by client');
}

@@ -232,6 +240,6 @@ }

}, {
key: 'addNativeEventListener',
value: function addNativeEventListener(event, callback) {
this.nativeEvents[event] = this.nativeEvents[event] || [];
this.nativeEvents[event].push(callback);
key: 'addSocketEventListener',
value: function addSocketEventListener(event, callback) {
this.socketEvents[event] = this.socketEvents[event] || [];
this.socketEvents[event].push(callback);

@@ -241,11 +249,11 @@ return this;

}, {
key: 'removeNativeEventListener',
value: function removeNativeEventListener(event, callback) {
if (this.nativeEvents[event]) {
this.nativeEvents[event] = this.nativeEvents[event].filter(function (cb) {
key: 'removeSocketEventListener',
value: function removeSocketEventListener(event, callback) {
if (this.socketEvents[event]) {
this.socketEvents[event] = this.socketEvents[event].filter(function (cb) {
return cb !== callback;
});
if (!this.nativeEvents[event].length) {
delete this.nativeEvents[event];
if (!this.socketEvents[event].length) {
delete this.socketEvents[event];
}

@@ -252,0 +260,0 @@ }

@@ -67,2 +67,4 @@ 'use strict';

var CONNECTION_MANAGE_EVENTS = [_constants.NativeSocketEvents.CONNECTING, _constants.NativeSocketEvents.CONNECT, _constants.NativeSocketEvents.CONNECT_ERROR, _constants.NativeSocketEvents.DISCONNECT, _constants.NativeSocketEvents.RECONNECT_ATTEMPT];
var RTClient = (_dec = _utils2.default.deferred(1000), (_class = function () {

@@ -98,3 +100,3 @@ function RTClient(config) {

this.runNativeEventListeners = function (event) {
this.runSocketEventListeners = function (event) {
for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {

@@ -104,4 +106,4 @@ args[_key2 - 1] = arguments[_key2];

if (_this.nativeEvents[event]) {
_this.nativeEvents[event].forEach(function (callback) {
if (_this.socketEvents[event]) {
_this.socketEvents[event].forEach(function (callback) {
return callback.apply(undefined, args);

@@ -113,44 +115,50 @@ });

this.addConnectingEventListener = function (callback) {
return _this.addNativeEventListener(_constants.NativeSocketEvents.CONNECTING, callback);
return _this.addSocketEventListener(_constants.NativeSocketEvents.CONNECTING, callback);
};
this.removeConnectingEventListener = function (callback) {
return _this.removeNativeEventListener(_constants.NativeSocketEvents.CONNECTING, callback);
return _this.removeSocketEventListener(_constants.NativeSocketEvents.CONNECTING, callback);
};
this.addConnectEventListener = function (callback) {
return _this.addNativeEventListener(_constants.NativeSocketEvents.CONNECT, callback);
return _this.addSocketEventListener(_constants.NativeSocketEvents.CONNECT, callback);
};
this.removeConnectEventListener = function (callback) {
return _this.removeNativeEventListener(_constants.NativeSocketEvents.CONNECT, callback);
return _this.removeSocketEventListener(_constants.NativeSocketEvents.CONNECT, callback);
};
this.addConnectErrorEventListener = function (callback) {
return _this.addNativeEventListener(_constants.NativeSocketEvents.CONNECT_ERROR, callback);
return _this.addSocketEventListener(_constants.NativeSocketEvents.CONNECT_ERROR, callback);
};
this.removeConnectErrorEventListener = function (callback) {
return _this.removeNativeEventListener(_constants.NativeSocketEvents.CONNECT_ERROR, callback);
return _this.removeSocketEventListener(_constants.NativeSocketEvents.CONNECT_ERROR, callback);
};
this.addDisconnectEventListener = function (callback) {
return _this.addNativeEventListener(_constants.NativeSocketEvents.DISCONNECT, callback);
return _this.addSocketEventListener(_constants.NativeSocketEvents.DISCONNECT, callback);
};
this.removeDisconnectEventListener = function (callback) {
return _this.removeNativeEventListener(_constants.NativeSocketEvents.DISCONNECT, callback);
return _this.removeSocketEventListener(_constants.NativeSocketEvents.DISCONNECT, callback);
};
this.addReconnectAttemptEventListener = function (callback) {
return _this.addNativeEventListener(_constants.NativeSocketEvents.RECONNECT_ATTEMPT, callback);
return _this.addSocketEventListener(_constants.NativeSocketEvents.RECONNECT_ATTEMPT, callback);
};
this.removeReconnectAttemptEventListener = function (callback) {
return _this.removeNativeEventListener(_constants.NativeSocketEvents.RECONNECT_ATTEMPT, callback);
return _this.removeSocketEventListener(_constants.NativeSocketEvents.RECONNECT_ATTEMPT, callback);
};
this.removeConnectionListeners = function () {
CONNECTION_MANAGE_EVENTS.forEach(function (event) {
return _this.removeSocketEventListener(event);
});
};
this.config = new _config2.default(config);
this.nativeEvents = {};
this.socketEvents = {};

@@ -184,3 +192,3 @@ var socketContext = {

if (!this.session) {
this.session = new _session2.default(this.config, this.runNativeEventListeners, this.onSessionDisconnect);
this.session = new _session2.default(this.config, this.runSocketEventListeners, this.onSessionDisconnect);
this.session.getSocket().then(function () {

@@ -201,3 +209,3 @@ _this2.subscriptions.initialize();

value: function terminate() {
this.nativeEvents = {};
this.socketEvents = {};

@@ -220,3 +228,3 @@ this.subscriptions.reset();

this.runNativeEventListeners(_constants.NativeSocketEvents.DISCONNECT, reason || 'disconnected by client');
this.runSocketEventListeners(_constants.NativeSocketEvents.DISCONNECT, reason || 'disconnected by client');
}

@@ -232,6 +240,6 @@ }

}, {
key: 'addNativeEventListener',
value: function addNativeEventListener(event, callback) {
this.nativeEvents[event] = this.nativeEvents[event] || [];
this.nativeEvents[event].push(callback);
key: 'addSocketEventListener',
value: function addSocketEventListener(event, callback) {
this.socketEvents[event] = this.socketEvents[event] || [];
this.socketEvents[event].push(callback);

@@ -241,11 +249,11 @@ return this;

}, {
key: 'removeNativeEventListener',
value: function removeNativeEventListener(event, callback) {
if (this.nativeEvents[event]) {
this.nativeEvents[event] = this.nativeEvents[event].filter(function (cb) {
key: 'removeSocketEventListener',
value: function removeSocketEventListener(event, callback) {
if (this.socketEvents[event]) {
this.socketEvents[event] = this.socketEvents[event].filter(function (cb) {
return cb !== callback;
});
if (!this.nativeEvents[event].length) {
delete this.nativeEvents[event];
if (!this.socketEvents[event].length) {
delete this.socketEvents[event];
}

@@ -252,0 +260,0 @@ }

{
"name": "backendless-rt-client",
"version": "0.0.10",
"version": "0.0.11",
"description": "Backendless RT Client for connect to Backendless RT Server",

@@ -5,0 +5,0 @@ "browser": "dist/backendless-rt-client.js",

@@ -8,2 +8,10 @@ import { NativeSocketEvents } from './constants'

const CONNECTION_MANAGE_EVENTS = [
NativeSocketEvents.CONNECTING,
NativeSocketEvents.CONNECT,
NativeSocketEvents.CONNECT_ERROR,
NativeSocketEvents.DISCONNECT,
NativeSocketEvents.RECONNECT_ATTEMPT,
]
export default class RTClient {

@@ -14,3 +22,3 @@

this.nativeEvents = {}
this.socketEvents = {}

@@ -46,3 +54,3 @@ const socketContext = {

if (!this.session) {
this.session = new Session(this.config, this.runNativeEventListeners, this.onSessionDisconnect)
this.session = new Session(this.config, this.runSocketEventListeners, this.onSessionDisconnect)
this.session.getSocket()

@@ -63,3 +71,3 @@ .then(() => {

terminate() {
this.nativeEvents = {}
this.socketEvents = {}

@@ -81,3 +89,3 @@ this.subscriptions.reset()

this.runNativeEventListeners(NativeSocketEvents.DISCONNECT, reason || 'disconnected by client')
this.runSocketEventListeners(NativeSocketEvents.DISCONNECT, reason || 'disconnected by client')
}

@@ -102,5 +110,5 @@ }

addNativeEventListener(event, callback) {
this.nativeEvents[event] = this.nativeEvents[event] || []
this.nativeEvents[event].push(callback)
addSocketEventListener(event, callback) {
this.socketEvents[event] = this.socketEvents[event] || []
this.socketEvents[event].push(callback)

@@ -110,8 +118,8 @@ return this

removeNativeEventListener(event, callback) {
if (this.nativeEvents[event]) {
this.nativeEvents[event] = this.nativeEvents[event].filter(cb => cb !== callback)
removeSocketEventListener(event, callback) {
if (this.socketEvents[event]) {
this.socketEvents[event] = this.socketEvents[event].filter(cb => cb !== callback)
if (!this.nativeEvents[event].length) {
delete this.nativeEvents[event]
if (!this.socketEvents[event].length) {
delete this.socketEvents[event]
}

@@ -123,26 +131,28 @@ }

runNativeEventListeners = (event, ...args) => {
if (this.nativeEvents[event]) {
this.nativeEvents[event].forEach(callback => callback(...args))
runSocketEventListeners = (event, ...args) => {
if (this.socketEvents[event]) {
this.socketEvents[event].forEach(callback => callback(...args))
}
}
addConnectingEventListener = callback => this.addNativeEventListener(NativeSocketEvents.CONNECTING, callback)
removeConnectingEventListener = callback => this.removeNativeEventListener(NativeSocketEvents.CONNECTING, callback)
addConnectingEventListener = callback => this.addSocketEventListener(NativeSocketEvents.CONNECTING, callback)
removeConnectingEventListener = callback => this.removeSocketEventListener(NativeSocketEvents.CONNECTING, callback)
addConnectEventListener = callback => this.addNativeEventListener(NativeSocketEvents.CONNECT, callback)
removeConnectEventListener = callback => this.removeNativeEventListener(NativeSocketEvents.CONNECT, callback)
addConnectEventListener = callback => this.addSocketEventListener(NativeSocketEvents.CONNECT, callback)
removeConnectEventListener = callback => this.removeSocketEventListener(NativeSocketEvents.CONNECT, callback)
addConnectErrorEventListener = callback => this.addNativeEventListener(NativeSocketEvents.CONNECT_ERROR, callback)
removeConnectErrorEventListener = callback => this.removeNativeEventListener(NativeSocketEvents.CONNECT_ERROR, callback)
addConnectErrorEventListener = callback => this.addSocketEventListener(NativeSocketEvents.CONNECT_ERROR, callback)
removeConnectErrorEventListener = callback => this.removeSocketEventListener(NativeSocketEvents.CONNECT_ERROR, callback)
addDisconnectEventListener = callback => this.addNativeEventListener(NativeSocketEvents.DISCONNECT, callback)
removeDisconnectEventListener = callback => this.removeNativeEventListener(NativeSocketEvents.DISCONNECT, callback)
addDisconnectEventListener = callback => this.addSocketEventListener(NativeSocketEvents.DISCONNECT, callback)
removeDisconnectEventListener = callback => this.removeSocketEventListener(NativeSocketEvents.DISCONNECT, callback)
addReconnectAttemptEventListener = callback => this.addNativeEventListener(NativeSocketEvents.RECONNECT_ATTEMPT, callback)
removeReconnectAttemptEventListener = callback => this.removeNativeEventListener(NativeSocketEvents.RECONNECT_ATTEMPT, callback)
addReconnectAttemptEventListener = callback => this.addSocketEventListener(NativeSocketEvents.RECONNECT_ATTEMPT, callback)
removeReconnectAttemptEventListener = callback => this.removeSocketEventListener(NativeSocketEvents.RECONNECT_ATTEMPT, callback)
removeConnectionListeners = () => {
CONNECTION_MANAGE_EVENTS.forEach(event => this.removeSocketEventListener(event))
}
}

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

Sorry, the diff of this file is not supported yet

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

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