Comparing version 2.2.0 to 2.2.1
{ | ||
"name": "primus", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "Primus is a simple abstraction around real-time frameworks. It allows you to easily switch between different frameworks without any code changes.", | ||
@@ -12,2 +12,3 @@ "main": "index.js", | ||
}, | ||
"homepage": "http://primus.io", | ||
"repository": { | ||
@@ -42,4 +43,4 @@ "type": "git", | ||
"e-json": "0.0.x", | ||
"engine.io": "1.0.x", | ||
"engine.io-client": "1.0.x", | ||
"engine.io": "1.1.x", | ||
"engine.io-client": "1.1.x", | ||
"global-wrap": "1.4.x", | ||
@@ -46,0 +47,0 @@ "jsonh": "0.0.x", |
@@ -280,2 +280,3 @@ /*globals require, define */ | ||
primus.latency = 0; // Latency between messages. | ||
primus.stamps = 0; // Counter to make timestamps unqiue. | ||
primus.disconnect = false; // Did we receive a disconnect packet? | ||
@@ -1206,3 +1207,6 @@ primus.transport = options.transport; // Transport options. | ||
// | ||
for (; part = parser.exec(query); result[part[1]] = part[2]); | ||
for (; | ||
part = parser.exec(query); | ||
result[decodeURIComponent(part[1])] = decodeURIComponent(part[2]) | ||
); | ||
@@ -1224,3 +1228,3 @@ return result; | ||
if (obj.hasOwnProperty(key)) { | ||
pairs.push(key +'='+ obj[key]); | ||
pairs.push(encodeURIComponent(key) +'='+ encodeURIComponent(obj[key])); | ||
} | ||
@@ -1277,3 +1281,3 @@ } | ||
var querystring = this.querystring(options.query || ''); | ||
querystring._primuscb = +new Date(); | ||
querystring._primuscb = +new Date() +'-'+ this.stamps++; | ||
options.query = this.querystringify(querystring); | ||
@@ -1280,0 +1284,0 @@ |
@@ -50,2 +50,9 @@ 'use strict'; | ||
forceBase64: true, | ||
// | ||
// Force timestamps on every single connection. Engine.IO only does this | ||
// for polling by default, but WebSockets require an explicit `true` | ||
// boolean. | ||
// | ||
timestampRequests: true, | ||
path: this.pathname, | ||
@@ -58,3 +65,3 @@ transports: !primus.AVOID_WEBSOCKETS | ||
// | ||
// Nuke a growing memory leak as engine.io pushes instances in to an exposed | ||
// Nuke a growing memory leak as Engine.IO pushes instances in to an exposed | ||
// `sockets` array. | ||
@@ -69,8 +76,6 @@ // | ||
// | ||
socket.onopen = primus.emits('open'); | ||
socket.onerror = primus.emits('error'); | ||
socket.onclose = primus.emits('end'); | ||
socket.onmessage = primus.emits('data', function parse(evt) { | ||
return evt.data; | ||
}); | ||
socket.on('open', primus.emits('open')); | ||
socket.on('error', primus.emits('error')); | ||
socket.on('close', primus.emits('end')); | ||
socket.on('message', primus.emits('data')); | ||
}); | ||
@@ -103,3 +108,3 @@ | ||
if (socket) { | ||
socket.onerror = socket.onopen = socket.onclose = socket.onmessage = function () {}; | ||
socket.removeAllListeners(); | ||
socket.close(); | ||
@@ -106,0 +111,0 @@ socket = null; |
@@ -95,7 +95,3 @@ 'use strict'; | ||
if (socket) { | ||
socket.removeAllListeners('error') | ||
.removeAllListeners('connect') | ||
.removeAllListeners('message') | ||
.removeAllListeners('disconnect') | ||
.removeAllListeners('connect_failed'); | ||
socket.removeAllListeners(); | ||
@@ -102,0 +98,0 @@ // |
@@ -51,3 +51,3 @@ 'use strict'; | ||
socket.onclose = function (e) { | ||
var event = e && e.code === 1002 ? 'error' : 'end'; | ||
var event = e && e.code > 1000 ? 'error' : 'end'; | ||
@@ -54,0 +54,0 @@ // |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
0
356267
50
8936