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

cometd

Package Overview
Dependencies
Maintainers
1
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cometd - npm Package Compare versions

Comparing version 0.5.5 to 1.0.0

81

cometD.js

@@ -8,3 +8,2 @@ exports.cometD = function () {

};
var jar = request.jar();
var handshaked = false;

@@ -15,6 +14,7 @@ var requestId = 1;

var stop = false;
return {
jar: request.jar(),
stop: true,
topic: "",
errorNoResponse: 0,
errorMultiple: 0,

@@ -34,3 +34,3 @@ errorTimeout: 0,

connect: function () {
if (!stop) {
if (!this.stop) {
if(this.debug){

@@ -85,4 +85,4 @@ console.log('[' + this.topic + ']: Conneting...\n');

self.stop = true;
self.reInitialization();
self.stop();
}else{

@@ -102,4 +102,5 @@ if(self.debug){

//Set timeout Error to zero
self.errorTimeout = 0;
self.errorMultiple = 0;
self.errorTimeout = 0;
self.errorMultiple = 0;
self.errorNoResponse = 0;

@@ -127,4 +128,4 @@ if(self.debug){

}
self.stop = true;
self.reInitialization();
self.stop();
nothing = false;

@@ -142,4 +143,4 @@ }else if(!!body[i].advice && !!body[i].advice['multiple-clients']){

self.stop = true;
self.reInitialization();
self.stop();
}else{

@@ -149,3 +150,4 @@ //Reconnect

//Set timeout Error to zero
self.errorTimeout = 0;
self.errorTimeout = 0;
self.errorNoResponse = 0;
//Set increment errorMultiple

@@ -164,4 +166,5 @@ self.errorMultiple++;

//Set timeout Error to zero
self.errorTimeout = 0;
self.errorMultiple = 0;
self.errorTimeout = 0;
self.errorMultiple = 0;
self.errorNoResponse = 0;

@@ -185,12 +188,21 @@ if(self.debug){

}else if(!response){
//Reconnect
self.connect();
//Set timeout Error to zero
self.errorTimeout = 0;
self.errorMultiple = 0;
if(self.errorNoResponse > 10){
if(self.debug){
console.log('[Connect] [' + self.topic + '] Got to many empty responses. Reinitialize...\n');
}
if(self.debug){
console.log('[Connect] [' + self.topic + '] Response: ' + response + '\n');
self.stop = true;
self.reInitialization();
}else{
//Reconnect
self.connect();
//Set timeout Error to zero
self.errorNoResponse++;
self.errorTimeout = 0;
self.errorMultiple = 0;
if(self.debug){
console.log('[Connect] [' + self.topic + '] Empty response. Reconnect...\n');
}
}
console.log('[Connect] [' + self.topic + '] Empty response. Reconnect...\n');
}else{

@@ -200,4 +212,4 @@ if(self.debug){

}
self.stop = true;
self.reInitialization();
self.stop();
}

@@ -225,3 +237,3 @@ }else if(error && error.code === 'ETIMEDOUT'){

{
jar: jar,
jar: this.jar,
timeout: this.timeout,

@@ -275,6 +287,4 @@ gzip: true,

requestId++;
self.stop = false;
self.notify('/meta/handshake', body);
self.addEventListener('/meta/subscribe', function(){
self.connect();
});
self.subscribe();

@@ -297,3 +307,3 @@

{
jar: jar,
jar: this.jar,
gzip: true,

@@ -310,3 +320,3 @@ url: config.url,

if(!stop){
if(!this.stop){

@@ -346,3 +356,3 @@ if (handshaked) {

self.notify('/meta/subscribe', body);
self.start();
self.connect();
}

@@ -366,3 +376,3 @@ else if (!body || !body[0].successful) {

{
jar: jar,
jar: this.jar,
gzip: true,

@@ -395,8 +405,2 @@ url: config.url,

},
stop: function () {
stop = true;
},
start: function(){
stop = false;
},
reInitialization: function(){

@@ -408,5 +412,3 @@ function HandshakeListener(){

self = object;
},
onEvent: function(){
self.subscribe(self.topic);
//self.jar.removeCookies(config.url);
}

@@ -419,7 +421,6 @@ }

this.addEventListener('/meta/handshake', handshakeListener.onEvent);
this.handshake();
}
}
}
};
{
"name": "cometd",
"version": "0.5.5",
"version": "1.0.0",
"description": "A lightweight cometD Library with lightweight dependencies. No jQuery needed!",

@@ -23,3 +23,7 @@ "main": "cometD.js",

},
"dependencies": {
"request": "2.72.0",
"zlib": "1.0.5"
},
"homepage": "https://github.com/Citrullin/cometd#readme"
}
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