Comparing version 0.5.5 to 1.0.0
@@ -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" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
367
1
22307
2
4
+ Addedrequest@2.72.0
+ Addedzlib@1.0.5
+ Addedansi-regex@2.1.1(transitive)
+ Addedansi-styles@2.2.1(transitive)
+ Addedasn1@0.2.6(transitive)
+ Addedassert-plus@0.2.01.0.0(transitive)
+ Addedasync@2.6.4(transitive)
+ Addedaws-sign2@0.6.0(transitive)
+ Addedaws4@1.13.2(transitive)
+ Addedbcrypt-pbkdf@1.0.2(transitive)
+ Addedbl@1.1.2(transitive)
+ Addedboom@2.10.1(transitive)
+ Addedcaseless@0.11.0(transitive)
+ Addedchalk@1.1.3(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addedcommander@2.20.3(transitive)
+ Addedcore-util-is@1.0.21.0.3(transitive)
+ Addedcryptiles@2.0.5(transitive)
+ Addeddashdash@1.14.1(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedecc-jsbn@0.1.2(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedextend@3.0.2(transitive)
+ Addedextsprintf@1.3.0(transitive)
+ Addedforever-agent@0.6.1(transitive)
+ Addedform-data@1.0.1(transitive)
+ Addedgenerate-function@2.3.1(transitive)
+ Addedgenerate-object-property@1.2.0(transitive)
+ Addedgetpass@0.1.7(transitive)
+ Addedhar-validator@2.0.6(transitive)
+ Addedhas-ansi@2.0.0(transitive)
+ Addedhawk@3.1.3(transitive)
+ Addedhoek@2.16.3(transitive)
+ Addedhttp-signature@1.1.1(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedis-my-ip-valid@1.0.1(transitive)
+ Addedis-my-json-valid@2.20.6(transitive)
+ Addedis-property@1.0.2(transitive)
+ Addedis-typedarray@1.0.0(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedisstream@0.1.2(transitive)
+ Addedjsbn@0.1.1(transitive)
+ Addedjson-schema@0.4.0(transitive)
+ Addedjson-stringify-safe@5.0.1(transitive)
+ Addedjsonpointer@5.0.1(transitive)
+ Addedjsprim@1.4.2(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addednode-uuid@1.4.8(transitive)
+ Addedoauth-sign@0.8.2(transitive)
+ Addedpinkie@2.0.4(transitive)
+ Addedpinkie-promise@2.0.1(transitive)
+ Addedprocess-nextick-args@1.0.7(transitive)
+ Addedqs@6.1.2(transitive)
+ Addedreadable-stream@2.0.6(transitive)
+ Addedrequest@2.72.0(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsntp@1.0.9(transitive)
+ Addedsshpk@1.18.0(transitive)
+ Addedstring_decoder@0.10.31(transitive)
+ Addedstringstream@0.0.6(transitive)
+ Addedstrip-ansi@3.0.1(transitive)
+ Addedsupports-color@2.0.0(transitive)
+ Addedtough-cookie@2.2.2(transitive)
+ Addedtunnel-agent@0.4.3(transitive)
+ Addedtweetnacl@0.14.5(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedverror@1.10.0(transitive)
+ Addedxtend@4.0.2(transitive)
+ Addedzlib@1.0.5(transitive)