Comparing version 0.8.11 to 0.8.12
{ | ||
"name": "Ably", | ||
"version": "0.8.11", | ||
"version": "0.8.12", | ||
"homepage": "https://www.ably.io/", | ||
@@ -5,0 +5,0 @@ "authors": [ |
/** | ||
* @license Copyright 2015, Ably | ||
* | ||
* Ably JavaScript Library v0.8.11 | ||
* Ably JavaScript Library v0.8.12 | ||
* https://github.com/ably/ably-js | ||
@@ -6,0 +6,0 @@ * |
@@ -81,2 +81,5 @@ (function() { | ||
} | ||
Utils.nextTick(function() { | ||
self.recv(); | ||
}); | ||
}); | ||
@@ -114,7 +117,2 @@ connectRequest.exec(); | ||
this.recvUri = baseConnectionUri + '/recv'; | ||
var self = this; | ||
Utils.nextTick(function() { | ||
self.recv(); | ||
}) | ||
}; | ||
@@ -121,0 +119,0 @@ |
@@ -71,2 +71,3 @@ var JSONPTransport = (function() { | ||
this.params = params || {}; | ||
this.params.rnd = Utils.randStr(); | ||
this.body = body; | ||
@@ -73,0 +74,0 @@ this.requestMode = requestMode; |
@@ -58,3 +58,3 @@ var XHRRequest = (function() { | ||
params = params || {}; | ||
params.rnd = String(Math.random()).substr(2); | ||
params.rnd = Utils.randStr(); | ||
if(needJsonEnvelope() && !params.envelope) | ||
@@ -61,0 +61,0 @@ params.envelope = 'json'; |
@@ -15,3 +15,3 @@ var XHRTransport = (function() { | ||
Http.Request(upUrl, null, null, null, function(err, responseText) { | ||
var result = (!err && responseText == 'yes'); | ||
var result = (!err && responseText.replace(/\n/, '') == 'yes'); | ||
Logger.logAction(Logger.LOG_MICRO, 'XHRTransport.checkConnectivity()', 'Result: ' + result); | ||
@@ -18,0 +18,0 @@ callback(null, result); |
/** | ||
* @license Copyright 2015, Ably | ||
* | ||
* Ably JavaScript Library v0.8.11 | ||
* Ably JavaScript Library v0.8.12 | ||
* https://github.com/ably/ably-js | ||
@@ -6,0 +6,0 @@ * |
/* | ||
Copyright 2015, Ably | ||
Ably JavaScript Library v0.8.11 | ||
Ably JavaScript Library v0.8.12 | ||
https://github.com/ably/ably-js | ||
@@ -6,0 +6,0 @@ |
/** | ||
* @license Copyright 2015, Ably | ||
* | ||
* Ably JavaScript Library v0.8.11 | ||
* Ably JavaScript Library v0.8.12 | ||
* https://github.com/ably/ably-js | ||
@@ -456,2 +456,6 @@ * | ||
Utils.randStr = function() { | ||
return String(Math.random()).substr(2); | ||
}; | ||
return Utils; | ||
@@ -458,0 +462,0 @@ })(); |
/* | ||
Copyright 2015, Ably | ||
Ably JavaScript Library v0.8.11 | ||
Ably JavaScript Library v0.8.12 | ||
https://github.com/ably/ably-js | ||
@@ -21,6 +21,6 @@ | ||
b.defaultGetHeaders=function(a){a=a||"json";return{accept:"json"===a?f.json:f[a]+","+f.json,"X-Ably-Version":Defaults.apiVersion}};b.defaultPostHeaders=function(a){a=a||"json";return{accept:"json"===a?f.json:f[a]+","+f.json,"content-type":"json"===a?f.json:f[a],"X-Ably-Version":Defaults.apiVersion}};b.arrRandomElement=function(a){return a.splice(Math.floor(Math.random()*a.length))};b.toQueryString=function(a){var b=[];if(a)for(var c in a)b.push(encodeURIComponent(c)+"="+encodeURIComponent(a[c])); | ||
return b.length?"?"+b.join("&"):""};b.parseQueryString=function(b){for(var e,c=/([^?&=]+)=?([^&]*)/g,d={};e=c.exec(b);)d[decodeURIComponent(e[1])]=decodeURIComponent(e[2]);return d};b.inspect=function(b){return JSON.stringify(b)};b.inspectError=function(a){return a&&"ErrorInfo"==a.constructor.name?a.toString():b.inspect(a)};return b}();(function(){function b(b,a){var d=a.host||"",e=a.tlshost||"",h={key:b,tls:a.encrypted||!1,log:{level:4}};a.ablyClientId&&(h.clientId=a.ablyClientId);a.authEndpoint&& | ||
(h.authUrl=a.authEndpoint);a.auth&&a.auth.params&&(h.authParams=a.auth.params);a.auth&&a.auth.headers&&(h.authHeaders=a.auth.headers);d&&0!=d.length&&(d=d.split(":"),h.realtimeHost=h.restHost=d[0],1<d.length&&(h.port=d[1]));e&&0!=e.length&&(d=e.split(":"),1<d.length&&(h.tlsPort=d[1]));e=this.ably=new (c||window.Ably).Realtime(h);this.clientId=h.clientId;this.connection=new g(e.connection);this.channels={}}function g(a){l.call(this);this.connection=a;var b=this;a.on(function(a){var c=m[a.previous], | ||
d=b.state=m[a.current];b.emit(d);b.emit("state_change",{previous:c,current:d});a.retryIn&&b.emit("connecting_in",a.retryIn)})}function f(a,b){var c=this;this.active=!0;this.channel=a.ably.channels.get(b);this.name=b;if(this.isPresence=0==b.indexOf("presence-"))this.members=new e(this,a.clientId);this.channel.subscribe(function(a){JSON.stringify(this);JSON.stringify(a);c.channel.emit(a.name,a.data)});this.bindings={};this.bind_alls=[];if(this.isPresence){var d=this.channel.presence;this.entered=!1; | ||
d.subscribe("enter",function(a){c.entered&&a.clientId!==c.members.myID&&(a=c.members.addMember(a.clientId,a.clientInfo))&&c.channel.emit("pusher:member_added",a)});d.subscribe("leave",function(a){c.entered&&(a=c.members.removeMember(a.clientId))&&c.channel.emit("pusher:member_removed",a)});d.enter(function(a){if(a=d.get())for(var b=0;b<a.length;b++)c.members.addMember(a[b].clientId,a[b].clientData);c.entered=!0;c._sendEvent("pusher:subscription_succeeded",c.members)})}this.channel.on(function(a){"attached"=== | ||
return b.length?"?"+b.join("&"):""};b.parseQueryString=function(b){for(var e,c=/([^?&=]+)=?([^&]*)/g,d={};e=c.exec(b);)d[decodeURIComponent(e[1])]=decodeURIComponent(e[2]);return d};b.inspect=function(b){return JSON.stringify(b)};b.inspectError=function(a){return a&&"ErrorInfo"==a.constructor.name?a.toString():b.inspect(a)};b.randStr=function(){return String(Math.random()).substr(2)};return b}();(function(){function b(b,a){var d=a.host||"",e=a.tlshost||"",h={key:b,tls:a.encrypted||!1,log:{level:4}}; | ||
a.ablyClientId&&(h.clientId=a.ablyClientId);a.authEndpoint&&(h.authUrl=a.authEndpoint);a.auth&&a.auth.params&&(h.authParams=a.auth.params);a.auth&&a.auth.headers&&(h.authHeaders=a.auth.headers);d&&0!=d.length&&(d=d.split(":"),h.realtimeHost=h.restHost=d[0],1<d.length&&(h.port=d[1]));e&&0!=e.length&&(d=e.split(":"),1<d.length&&(h.tlsPort=d[1]));e=this.ably=new (c||window.Ably).Realtime(h);this.clientId=h.clientId;this.connection=new g(e.connection);this.channels={}}function g(a){l.call(this);this.connection= | ||
a;var b=this;a.on(function(a){var c=m[a.previous],d=b.state=m[a.current];b.emit(d);b.emit("state_change",{previous:c,current:d});a.retryIn&&b.emit("connecting_in",a.retryIn)})}function f(a,b){var c=this;this.active=!0;this.channel=a.ably.channels.get(b);this.name=b;if(this.isPresence=0==b.indexOf("presence-"))this.members=new e(this,a.clientId);this.channel.subscribe(function(a){JSON.stringify(this);JSON.stringify(a);c.channel.emit(a.name,a.data)});this.bindings={};this.bind_alls=[];if(this.isPresence){var d= | ||
this.channel.presence;this.entered=!1;d.subscribe("enter",function(a){c.entered&&a.clientId!==c.members.myID&&(a=c.members.addMember(a.clientId,a.clientInfo))&&c.channel.emit("pusher:member_added",a)});d.subscribe("leave",function(a){c.entered&&(a=c.members.removeMember(a.clientId))&&c.channel.emit("pusher:member_removed",a)});d.enter(function(a){if(a=d.get())for(var b=0;b<a.length;b++)c.members.addMember(a[b].clientId,a[b].clientData);c.entered=!0;c._sendEvent("pusher:subscription_succeeded",c.members)})}this.channel.on(function(a){"attached"=== | ||
this.event&&c.isPresence||("undefined"===typeof a&&(a={}),c._sendEvent(q[this.event]||this.event,a))})}function a(a,b){this.id=a;this.info=b}function e(a,b,c){this.count=0;this.members={};b&&(this.myID=b,this.me=this.addMember(b,c))}if("undefined"!==typeof window)var c=window.Ably;else if("undefined"===typeof c){var c=require("../.."),d=require("fs"),p=require("path"),r=require("vm"),n=function(a){a=p.resolve(__dirname,a);return r.runInThisContext(d.readFileSync(a,"utf8"),a)};"undefined"===typeof k&& | ||
@@ -27,0 +27,0 @@ n("../../common/lib/util/utils.js");"undefined"===typeof l&&n("../../common/lib/util/eventemitter.js")}var m={initialized:"initialized",connecting:"connecting",connected:"connected",disconnected:"disconnected",suspended:"unavailable",closed:"disconnected",failed:"failed"},q={attached:"pusher:subscription_succeeded",failed:"pusher:subscription_error"};b.prototype.disconnect=function(){this.ably.close();delete this.ably};b.prototype.channel=function(a){return this.channels[a]};b.prototype.subscribe= |
@@ -376,4 +376,5 @@ var ConnectionManager = (function() { | ||
/* temporarily pause events until the sync is complete */ | ||
self.state = self.states.synchronizing; | ||
/* If currently connected, temporarily pause events until the sync is complete */ | ||
if(self.state === self.states.connected) | ||
self.state = self.states.synchronizing; | ||
@@ -491,6 +492,6 @@ /* make this the active transport */ | ||
* - the transport was the active transport; or | ||
* - the transport was one of the pending transports (so we were in the connecting state) | ||
* and there are no longer any pending transports | ||
* - there is no active transport, and this is the last remaining | ||
* pending transport (so we were in the connecting state) | ||
*/ | ||
if(wasActive || (wasPending && this.pendingTransports.length === 0)) { | ||
if(wasActive || (this.activeProtocol === null && wasPending && this.pendingTransports.length === 0)) { | ||
/* Transport failures only imply a connection failure | ||
@@ -497,0 +498,0 @@ * if the reason for the failure is fatal */ |
@@ -21,3 +21,3 @@ Defaults.protocolVersion = 1; | ||
Defaults.version = '0.8.11'; | ||
Defaults.version = '0.8.12'; | ||
Defaults.apiVersion = '0.8'; | ||
@@ -24,0 +24,0 @@ |
@@ -266,3 +266,7 @@ var Utils = (function() { | ||
Utils.randStr = function() { | ||
return String(Math.random()).substr(2); | ||
}; | ||
return Utils; | ||
})(); |
{ | ||
"name": "ably", | ||
"description": "Realtime client library for Ably.io, the realtime messaging service", | ||
"version": "0.8.11", | ||
"version": "0.8.12", | ||
"main": "./nodejs/index.js", | ||
@@ -6,0 +6,0 @@ "dependencies": { |
# [Ably](https://www.ably.io) | ||
## Version: 0.8.11 | ||
## Version: 0.8.12 | ||
@@ -5,0 +5,0 @@ [![Build Status](https://travis-ci.org/ably/ably-js.png)](https://travis-ci.org/ably/ably-js) |
@@ -77,12 +77,5 @@ "use strict"; | ||
} | ||
channel.publish("name", "data", function(err) { | ||
if(err) { | ||
test.ok(false, 'Publish failed with error: ' + displayError(err)); | ||
closeAndFinish(test, realtime); | ||
return; | ||
} | ||
/* Timeout needed because connectionSerial is not necessarily set | ||
* by the time the publish callback is called */ | ||
channel.subscribe(function() { | ||
setTimeout(function() { | ||
test.equal(realtime.connection.serial, 0, "verify serial is 0 after ack received") | ||
test.equal(realtime.connection.serial, 0, "verify serial is 0 after message received") | ||
test.equal(realtime.connection.recoveryKey, realtime.connection.key + ':' + realtime.connection.serial, 'verify recovery key still correct'); | ||
@@ -95,5 +88,12 @@ | ||
}); | ||
}, 50); | ||
}, 0); | ||
}); | ||
test.equal(realtime.connection.serial, -1, "verify serial is -1 after publish but before ack") | ||
channel.publish("name", "data", function(err) { | ||
if(err) { | ||
test.ok(false, 'Publish failed with error: ' + displayError(err)); | ||
closeAndFinish(test, realtime); | ||
return; | ||
} | ||
}); | ||
test.equal(realtime.connection.serial, -1, "verify serial is -1 after publish but before message received") | ||
}); | ||
@@ -100,0 +100,0 @@ }); |
@@ -127,3 +127,3 @@ "use strict"; | ||
/* first, send a number of events to this channel */ | ||
test.expect(5 * testMessages.length + 1); | ||
test.expect(5 * testMessages.length - 1); | ||
var publishTasks = testMessages.map(function(event) { | ||
@@ -173,5 +173,2 @@ return function(publishCb) { | ||
nextPage = resultPage.next; | ||
} else { | ||
test.ok(!resultPage.hasNext(), 'Verify next link is present'); | ||
test.ok(resultPage.isLast(), 'Verify not last page'); | ||
} | ||
@@ -178,0 +175,0 @@ cb(); |
window.__karma__ = { base: '../' }; | ||
window.__karma__.files = {"browser/static/ably.js":true,"browser/static/ably.min.js":true,"browser/static/ably.noencryption.js":true,"browser/static/ably.noencryption.min.js":true,"browser/static/compat-pubnub.js":true,"browser/static/compat-pubnub.min.js":true,"browser/static/compat-pusher.js":true,"browser/static/compat-pusher.min.js":true,"browser/static/iframe.js":true,"browser/static/iframe.min.js":true,"browser/static/iframe-0.8.11.html":true,"browser/static/iframe.min-0.8.11.html":true,"browser/lib/util/base64.js":true,"node_modules/async/lib/async.js":true,"spec/common/globals/environment.js":true,"spec/common/globals/named_dependencies.js":true,"spec/common/modules/client_module.js":true,"spec/common/modules/shared_helper.js":true,"spec/common/modules/testapp_manager.js":true,"spec/common/modules/testapp_module.js":true,"spec/common/ably-common/test-resources/crypto-data-128.json":true,"spec/common/ably-common/test-resources/crypto-data-256.json":true,"spec/common/ably-common/test-resources/test-app-setup.json":true,"spec/support/browser_file_list.js":true,"spec/support/browser_setup.js":true,"spec/support/environment.vars.js":true,"spec/support/modules_helper.js":true,"spec/support/tear_down.js":true,"spec/support/test_helper.js":true,"spec/realtime/auth.test.js":true,"spec/realtime/channel.test.js":true,"spec/realtime/connection.test.js":true,"spec/realtime/connectivity.test.js":true,"spec/realtime/crypto.test.js":true,"spec/realtime/event_emitter.test.js":true,"spec/realtime/failure.test.js":true,"spec/realtime/history.test.js":true,"spec/realtime/init.test.js":true,"spec/realtime/message.test.js":true,"spec/realtime/presence.test.js":true,"spec/realtime/resume.test.js":true,"spec/realtime/upgrade.test.js":true,"spec/rest/auth.test.js":true,"spec/rest/capability.test.js":true,"spec/rest/defaults.test.js":true,"spec/rest/history.test.js":true,"spec/rest/init.test.js":true,"spec/rest/message.test.js":true,"spec/rest/presence.test.js":true,"spec/rest/stats.test.js":true,"spec/rest/time.test.js":true,"spec/browser/connection.test.js":true,"spec/browser/simple.test.js":true}; | ||
window.__karma__.files = {"browser/static/ably.js":true,"browser/static/ably.min.js":true,"browser/static/ably.noencryption.js":true,"browser/static/ably.noencryption.min.js":true,"browser/static/compat-pubnub.js":true,"browser/static/compat-pubnub.min.js":true,"browser/static/compat-pusher.js":true,"browser/static/compat-pusher.min.js":true,"browser/static/iframe.js":true,"browser/static/iframe.min.js":true,"browser/static/iframe-0.8.12.html":true,"browser/static/iframe.min-0.8.12.html":true,"browser/lib/util/base64.js":true,"node_modules/async/lib/async.js":true,"spec/common/globals/environment.js":true,"spec/common/globals/named_dependencies.js":true,"spec/common/modules/client_module.js":true,"spec/common/modules/shared_helper.js":true,"spec/common/modules/testapp_manager.js":true,"spec/common/modules/testapp_module.js":true,"spec/common/ably-common/test-resources/crypto-data-128.json":true,"spec/common/ably-common/test-resources/crypto-data-256.json":true,"spec/common/ably-common/test-resources/test-app-setup.json":true,"spec/support/browser_file_list.js":true,"spec/support/browser_setup.js":true,"spec/support/environment.vars.js":true,"spec/support/modules_helper.js":true,"spec/support/tear_down.js":true,"spec/support/test_helper.js":true,"spec/realtime/auth.test.js":true,"spec/realtime/channel.test.js":true,"spec/realtime/connection.test.js":true,"spec/realtime/connectivity.test.js":true,"spec/realtime/crypto.test.js":true,"spec/realtime/event_emitter.test.js":true,"spec/realtime/failure.test.js":true,"spec/realtime/history.test.js":true,"spec/realtime/init.test.js":true,"spec/realtime/message.test.js":true,"spec/realtime/presence.test.js":true,"spec/realtime/resume.test.js":true,"spec/realtime/upgrade.test.js":true,"spec/rest/auth.test.js":true,"spec/rest/capability.test.js":true,"spec/rest/defaults.test.js":true,"spec/rest/history.test.js":true,"spec/rest/init.test.js":true,"spec/rest/message.test.js":true,"spec/rest/presence.test.js":true,"spec/rest/stats.test.js":true,"spec/rest/time.test.js":true,"spec/browser/connection.test.js":true,"spec/browser/simple.test.js":true}; |
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 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
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
2132341
181
41029