Skip to content

Commit 9c14e8f

Browse files
committed
Reject outstanding RPC calls when the connection closes
1 parent ef0708c commit 9c14e8f

File tree

5 files changed

+23
-7
lines changed

5 files changed

+23
-7
lines changed

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-wamp",
3-
"version": "0.1.7",
3+
"version": "0.1.8",
44
"main": "./release/angular-wamp.js",
55
"authors": [
66
"David Dan <[email protected]>"

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "angular-wamp",
33
"description": "Angular library for Autobahn.js (WAMP v2)",
4-
"version": "0.1.7",
4+
"version": "0.1.8",
55
"author": "David Dan <[email protected]>",
66
"homepage": "https://github.com/voryx/angular-wamp",
77
"repository": {

release/angular-wamp.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,16 @@ if (typeof module !== "undefined" && typeof exports !== "undefined" && module.ex
244244

245245
connection.onclose = digestWrapper(function (reason, details) {
246246
$log.debug("Connection Closed: ", reason, details);
247-
sessionDeferred = $q.defer();
248-
sessionPromise = sessionDeferred.promise;
247+
248+
//Reject outstanding RPC calls
249+
for (var key in connection.session._call_reqs) {
250+
if (connection.session._call_reqs.hasOwnProperty(key)) {
251+
var error = new Error("Connection Closed");
252+
var call = connection.session._call_reqs[key];
253+
call[0].reject(error);
254+
}
255+
}
256+
249257
$rootScope.$broadcast("$wamp.close", {reason: reason, details: details});
250258
});
251259

release/angular-wamp.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/angular-wamp.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,16 @@ if (typeof module !== "undefined" && typeof exports !== "undefined" && module.ex
244244

245245
connection.onclose = digestWrapper(function (reason, details) {
246246
$log.debug("Connection Closed: ", reason, details);
247-
sessionDeferred = $q.defer();
248-
sessionPromise = sessionDeferred.promise;
247+
248+
//Reject outstanding RPC calls
249+
for (var key in connection.session._call_reqs) {
250+
if (connection.session._call_reqs.hasOwnProperty(key)) {
251+
var error = new Error("Connection Closed");
252+
var call = connection.session._call_reqs[key];
253+
call[0].reject(error);
254+
}
255+
}
256+
249257
$rootScope.$broadcast("$wamp.close", {reason: reason, details: details});
250258
});
251259

0 commit comments

Comments
 (0)