Comparing version 0.8.27 to 0.8.28
{ | ||
"name": "Ably", | ||
"version": "0.8.27", | ||
"version": "0.8.28", | ||
"homepage": "https://www.ably.io/", | ||
@@ -5,0 +5,0 @@ "authors": [ |
/** | ||
* @license Copyright 2016, Ably | ||
* | ||
* Ably JavaScript Library v0.8.27 | ||
* Ably JavaScript Library v0.8.28 | ||
* https://github.com/ably/ably-js | ||
@@ -6,0 +6,0 @@ * |
/** | ||
* @license Copyright 2016, Ably | ||
* | ||
* Ably JavaScript Library v0.8.27 | ||
* Ably JavaScript Library v0.8.28 | ||
* https://github.com/ably/ably-js | ||
@@ -6,0 +6,0 @@ * |
/* | ||
Copyright 2016, Ably | ||
Ably JavaScript Library v0.8.27 | ||
Ably JavaScript Library v0.8.28 | ||
https://github.com/ably/ably-js | ||
@@ -6,0 +6,0 @@ |
/** | ||
* @license Copyright 2016, Ably | ||
* | ||
* Ably JavaScript Library v0.8.27 | ||
* Ably JavaScript Library v0.8.28 | ||
* https://github.com/ably/ably-js | ||
@@ -6,0 +6,0 @@ * |
/* | ||
Copyright 2016, Ably | ||
Ably JavaScript Library v0.8.27 | ||
Ably JavaScript Library v0.8.28 | ||
https://github.com/ably/ably-js | ||
@@ -6,0 +6,0 @@ |
@@ -336,3 +336,3 @@ var RealtimeChannel = (function() { | ||
} else { | ||
this.setDetached(message); | ||
this.setFailed(message); | ||
} | ||
@@ -413,14 +413,21 @@ break; | ||
if(msgErr) { | ||
/* this is an error message */ | ||
var err = {statusCode: msgErr.statusCode, code: msgErr.code, message: msgErr.message}; | ||
this.setState('failed', err); | ||
var err = ErrorInfo.fromValues(message.error); | ||
this.setState('detached', err); | ||
this.failPendingMessages(err); | ||
} else { | ||
/* Don't bother with setState if there's no err and no statechange */ | ||
if(this.state !== 'detached') { | ||
this.setState('detached'); | ||
} | ||
this.failPendingMessages({statusCode: 404, code: 90001, message: 'Channel detached'}); | ||
this.failPendingMessages(new ErrorInfo('Channel detached', 90001, 404)); | ||
} | ||
}; | ||
RealtimeChannel.prototype.setFailed = function(message) { | ||
this.clearStateTimer(); | ||
var err = ErrorInfo.fromValues(message.error || {statusCode: 400, code: 90000, message: 'Channel failed'}); | ||
this.setState('failed', err); | ||
this.failPendingMessages(err); | ||
}; | ||
RealtimeChannel.prototype.setSuspended = function(err, suppressEvent) { | ||
@@ -427,0 +434,0 @@ if(this.state !== 'detached' && this.state !== 'failed') { |
@@ -22,3 +22,3 @@ Defaults.protocolVersion = 1; | ||
Defaults.version = '0.8.27'; | ||
Defaults.version = '0.8.28'; | ||
Defaults.libstring = 'js-' + Defaults.version; | ||
@@ -25,0 +25,0 @@ Defaults.apiVersion = '0.8'; |
{ | ||
"name": "ably", | ||
"description": "Realtime client library for Ably.io, the realtime messaging service", | ||
"version": "0.8.27", | ||
"version": "0.8.28", | ||
"main": "./nodejs/index.js", | ||
@@ -6,0 +6,0 @@ "dependencies": { |
# [Ably](https://www.ably.io) | ||
## Version: 0.8.27 | ||
## Version: 0.8.28 | ||
@@ -5,0 +5,0 @@ [![Build Status](https://travis-ci.org/ably/ably-js.png)](https://travis-ci.org/ably/ably-js) |
@@ -205,3 +205,3 @@ "use strict"; | ||
if(err) { | ||
test.ok(false, 'Unexpected attach failure'); | ||
test.ok(false, 'Unexpected attach failure: ' + helper.displayError(err)); | ||
closeAndFinish(test, realtime); | ||
@@ -436,3 +436,59 @@ return; | ||
/* | ||
* A server-sent DETACHED, with err, should detach the channel | ||
*/ | ||
exports.server_sent_detached = function(test) { | ||
var realtime = helper.AblyRealtime({transport: [helper.bestTransport]}), | ||
channelName = 'server_sent_detached', | ||
channel = realtime.channels.get(channelName); | ||
test.expect(2); | ||
realtime.connection.once('connected', function() { | ||
channel.attach(function(err) { | ||
if(err) { | ||
test.ok(false, helper.displayError(err)); | ||
closeAndFinish(test, realtime); | ||
return; | ||
} | ||
channel.on('detached', function(err) { | ||
test.ok(true, 'Channel was detached'); | ||
test.equal(err.code, 50000, 'check error is propogated'); | ||
closeAndFinish(test, realtime); | ||
}); | ||
var transport = realtime.connection.connectionManager.activeProtocol.getTransport(); | ||
transport.onProtocolMessage({action: 13, channel: channelName, error: {statusCode: 500, code: 50000, message: "generic serverside failure"}}); | ||
}); | ||
}); | ||
}; | ||
/* | ||
* A server-sent ERROR, with channel field, should fail the channel | ||
*/ | ||
exports.server_sent_error = function(test) { | ||
var realtime = helper.AblyRealtime({transport: [helper.bestTransport]}), | ||
channelName = 'server_sent_error', | ||
channel = realtime.channels.get(channelName); | ||
test.expect(2); | ||
realtime.connection.once('connected', function() { | ||
channel.attach(function(err) { | ||
if(err) { | ||
test.ok(false, helper.displayError(err)); | ||
closeAndFinish(test, realtime); | ||
return; | ||
} | ||
channel.on('failed', function(err) { | ||
test.ok(true, 'Channel was failed'); | ||
test.equal(err.code, 50000, 'check error is propogated'); | ||
closeAndFinish(test, realtime); | ||
}); | ||
var transport = realtime.connection.connectionManager.activeProtocol.getTransport(); | ||
transport.onProtocolMessage({action: 9, channel: channelName, error: {statusCode: 500, code: 50000, message: "generic serverside failure"}}); | ||
}); | ||
}); | ||
}; | ||
return module.exports = helper.withTimeout(exports); | ||
}); |
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
2250183
43319