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

connectycube

Package Overview
Dependencies
Maintainers
1
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connectycube - npm Package Compare versions

Comparing version 1.4.0 to 1.4.1

4

package.json
{
"name": "connectycube",
"description": "ConnectyCube JavaScript SDK",
"version": "1.4.0",
"homepage": "https://connectycube.com/developers/#/Javascript/",
"version": "1.4.1",
"homepage": "https://developers.connectycube.com/js/",
"main": "src/cubeMain.js",

@@ -7,0 +7,0 @@ "license": "(Apache-2.0)",

@@ -59,3 +59,3 @@ # Overview

cd node_modules/connectycube-reactnative/xmpp.js
make
make # for this step you need to use Node 9.x.x.
cd ../../../

@@ -62,0 +62,0 @@ cp -r node_modules/connectycube-reactnative/xmpp.js/node_modules/* node_modules/

'use strict';
var config = {
version: '1.4.0',
version: '1.4.1',
creds: {

@@ -6,0 +6,0 @@ appId: '',

@@ -57,6 +57,12 @@ 'use strict';

} else if (Utils.getEnv().reactnative) {
var xmpp = new XMPPClient.xmpp();
self.xmppClient = xmpp.client;
self.xmppClientReconnect = xmpp.reconnect;
require('../cubeDependencies').XMPPWebSocketTransport(self.xmppClient);
self.xmppClient = XMPPClient.client({
service: Config.chatProtocol.websocket,
credentials: function authenticate(auth, mechanism) {
var crds = {
username: self.xmppClient.cbUserName,
password: self.xmppClient.cbUserPassword,
}
return auth(crds);
}
});
}

@@ -96,3 +102,3 @@

};
this.contactList = new ContactListProxy(options);

@@ -483,3 +489,3 @@ this.privacylist = new PrivacyListProxy(options);

if (contact && contact.subscription === 'to') {
contact
contact
? contact.ask = null

@@ -501,3 +507,3 @@ : contact = {ask: null};

if (contact && contact.subscription === 'from') {
contact
contact
? contact.ask = null

@@ -507,3 +513,3 @@ : contact = {ask: null};

} else {
contact
contact
? contact.ask = null

@@ -519,3 +525,3 @@ : contact = {ask: null};

case 'unsubscribed':
contact
contact
? contact.ask = null

@@ -531,3 +537,3 @@ : contact = {ask: null};

case 'unsubscribe':
contact
contact
? contact.ask = null

@@ -858,133 +864,143 @@ : contact = {ask: null};

} else if (Utils.getEnv().reactnative){
var removeAllListeners = function(){
self.xmppClientListeners.forEach(function(listener){
self.xmppClient.removeListener(listener.name, listener.callback);
});
self.xmppClientListeners = [];
}
removeAllListeners();
var removeAllListeners = function(){
self.xmppClientListeners.forEach(function(listener){
self.xmppClient.removeListener(listener.name, listener.callback);
});
self.xmppClientListeners = [];
}
removeAllListeners();
const callbackConnect = function() {
Utils.DLog('[Chat]', 'CONNECTING');
};
self.xmppClient.on('connect', callbackConnect);
self.xmppClientListeners.push({name: 'connect', callback: callbackConnect});
const callbackConnect = function() {
Utils.DLog('[Chat]', 'CONNECTING');
};
self.xmppClient.on('connect', callbackConnect);
self.xmppClientListeners.push({name: 'connect', callback: callbackConnect});
const callbackOnline = function(jid) {
Utils.DLog('[Chat]', 'ONLINE');
const callbackOnline = function(jid) {
Utils.DLog('[Chat]', 'ONLINE');
self._postConnectActions(function(roster) {
callback(null, roster);
}, isInitialConnect);
};
self.xmppClient.on('online', callbackOnline);
self.xmppClientListeners.push({name: 'online', callback: callbackOnline});
self._postConnectActions(function(roster) {
callback(null, roster);
}, isInitialConnect);
};
self.xmppClient.on('online', callbackOnline);
self.xmppClientListeners.push({name: 'online', callback: callbackOnline});
const callbackStatus = function(status, value) {
Utils.DLog('[Chat]', 'status', status, value ? value.toString() : '')
const callbackOffline = function() {
Utils.DLog('[Chat]', 'OFFLINE');
};
self.xmppClient.on('offline', callbackOffline);
self.xmppClientListeners.push({name: 'offline', callback: callbackOffline});
if(status === "disconnect"){
Utils.DLog('[Chat]', 'DISCONNECTED');
const callbackDisconnect = function(data) {
Utils.DLog('[Chat]', 'DISCONNECTED');
var setIsConnectedToFalse = function(){
self.isConnected = false;
self._isConnecting = false;
}
var setIsConnectedToFalse = function(){
self.isConnected = false;
self._isConnecting = false;
}
// fire 'onDisconnectedListener' only once
if (self.isConnected && typeof self.onDisconnectedListener === 'function'){
setIsConnectedToFalse();
Utils.safeCallbackCall(self.onDisconnectedListener);
}else{
setIsConnectedToFalse();
}
// fire 'onDisconnectedListener' only once
if (self.isConnected && typeof self.onDisconnectedListener === 'function'){
setIsConnectedToFalse();
Utils.safeCallbackCall(self.onDisconnectedListener);
}else{
setIsConnectedToFalse();
}
// reconnect to chat and enable check connection
self._establishConnection(params);
}
};
self.xmppClient.on('status', callbackStatus);
self.xmppClientListeners.push({name: 'status', callback: callbackStatus});
// reconnect to chat and enable check connection
self._establishConnection(params);
};
self.xmppClient.on('disconnect', callbackDisconnect);
self.xmppClientListeners.push({name: 'disconnect', callback: callbackDisconnect});
// self.xmppClientReconnect.on('reconnecting', function() {
// Utils.DLog('[Chat]', 'RECONNECTING');
// });
//
// self.xmppClientReconnect.on('reconnected', function() {
// Utils.DLog('[Chat]', 'RECONNECTED');
// });
const callbackStatus = function(status, value) {
Utils.DLog('[Chat]', 'status', status, value ? value.toString() : '')
};
self.xmppClient.on('status', callbackStatus);
self.xmppClientListeners.push({name: 'status', callback: callbackStatus});
const callbackStanza = function(stanza) {
// console.log('stanza', stanza.toString())
// after 'input' and 'element' (only if stanza, not nonza)
// self.xmppClientReconnect.on('reconnecting', function() {
// Utils.DLog('[Chat]', 'RECONNECTING');
// });
//
// self.xmppClientReconnect.on('reconnected', function() {
// Utils.DLog('[Chat]', 'RECONNECTED');
// });
if (stanza.is('presence')) {
self._onPresence(stanza);
} else if (stanza.is('iq')) {
self._onIQ(stanza);
} else if(stanza.is('message')) {
if (stanza.attrs.type === 'headline') {
self._onSystemMessageListener(stanza);
} else if(stanza.attrs.type === 'error') {
self._onMessageErrorListener(stanza);
} else {
self._onMessage(stanza);
}
}
};
self.xmppClient.on('stanza', callbackStanza);
self.xmppClientListeners.push({name: 'stanza', callback: callbackStanza});
const callbackStanza = function(stanza) {
// console.log('stanza', stanza.toString())
// after 'input' and 'element' (only if stanza, not nonza)
const callbackError = function(err) {
Utils.DLog('[Chat]', 'ERROR:', err);
if (stanza.is('presence')) {
self._onPresence(stanza);
} else if (stanza.is('iq')) {
self._onIQ(stanza);
} else if(stanza.is('message')) {
if (stanza.attrs.type === 'headline') {
self._onSystemMessageListener(stanza);
} else if(stanza.attrs.type === 'error') {
self._onMessageErrorListener(stanza);
} else {
self._onMessage(stanza);
}
}
};
self.xmppClient.on('stanza', callbackStanza);
self.xmppClientListeners.push({name: 'stanza', callback: callbackStanza});
if (isInitialConnect) {
callback(err, null);
}
const callbackError = function(err) {
Utils.DLog('[Chat]', 'ERROR:', err);
self.isConnected = false;
self._isConnecting = false;
};
self.xmppClient.on('error', callbackError);
self.xmppClientListeners.push({name: 'error', callback: callbackError});
if (isInitialConnect) {
if(err.name == "SASLError"){
err = err.condition;
}
callback(err, null);
}
// self.xmppClient.on('element', function(element) {
// // console.log('element', element.toString())
// // after 'input'
// });
self.isConnected = false;
self._isConnecting = false;
};
self.xmppClient.on('error', callbackError);
self.xmppClientListeners.push({name: 'error', callback: callbackError});
// self.xmppClient.on('send', function(element) {
// // console.log('send', element.toString())
// // after write to socket
// });
// self.xmppClient.on('element', function(element) {
// // console.log('element', element.toString())
// // after 'input'
// });
// self.xmppClient.on('outgoing', function(element) {
// // before send
// // console.log('outgoing', element.toString())
// });
// self.xmppClient.on('send', function(element) {
// // console.log('send', element.toString())
// // after write to socket
// });
const callbackOutput = function(str) {
Utils.DLog('[Chat]', 'SENT:', str);
};
self.xmppClient.on('output', callbackOutput);
self.xmppClientListeners.push({name: 'output', callback: callbackOutput});
// self.xmppClient.on('outgoing', function(element) {
// // before send
// // console.log('outgoing', element.toString())
// });
const callbackInput = function(str) {
Utils.DLog('[Chat]', 'RECV:', str);
};
self.xmppClient.on('input', callbackInput);
self.xmppClientListeners.push({name: 'input', callback: callbackInput});
const callbackOutput = function(str) {
Utils.DLog('[Chat]', 'SENT:', str);
};
self.xmppClient.on('output', callbackOutput);
self.xmppClientListeners.push({name: 'output', callback: callbackOutput});
const callbackAuthenticate = function(authenticate) {
Utils.DLog('[Chat]', 'AUTHENTICATING');
const callbackInput = function(str) {
Utils.DLog('[Chat]', 'RECV:', str);
};
self.xmppClient.on('input', callbackInput);
self.xmppClientListeners.push({name: 'input', callback: callbackInput});
var userJidLocalPart = params.userId + '-' + Config.creds.appId;
return authenticate(userJidLocalPart, params.password)
};
self.xmppClient.handle('authenticate', callbackAuthenticate);
self.xmppClientListeners.push({name: 'authenticate', callback: callbackAuthenticate});
var options = {uri: Config.chatProtocol.websocket,
domain: Config.endpoints.chat};
self.xmppClient.start(options);
// define these properties so they will be used when authenticate (above)
Object.defineProperty(self.xmppClient, 'cbUserName', {
value: ChatUtils.buildUserJidLocalPart(params.userId),
writable: false
});
Object.defineProperty(self.xmppClient, 'cbUserPassword', {
value: params.password,
writable: false
});
//
self.xmppClient.start();
} else {

@@ -1187,3 +1203,3 @@ throw "Unsupported platform for Chat/XMPP functionality";

var messageStanza = ChatUtils.createMessageStanza(stanzaParams);
messageStanza.c('paused', {

@@ -1190,0 +1206,0 @@ xmlns: ChatUtils.MARKERS.STATES

@@ -44,2 +44,5 @@ 'use strict';

},
buildUserJidLocalPart: function(userId) {
return userId + '-' + Config.creds.appId;
},
createMessageStanza: function(params) {

@@ -46,0 +49,0 @@ if(Utils.getEnv().browser){

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