Skip to content
This repository was archived by the owner on Oct 20, 2022. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ handlers[WAMP.CALL] = function (session, args) {
var callId = args.shift();
var options = args.shift();
var procUri = args.shift();
args = args || [];
args = args.shift() || [];
var resultCallback = function(err, args) {
if (err) {
var msg = [
Expand All @@ -109,7 +109,7 @@ handlers[WAMP.CALL] = function (session, args) {
session.send(msg);
}
};
if (!this.callrpc(procUri, args, resultCallback)) {
if (!this.callrpc(procUri, args, resultCallback, session)) {
var msg = [
WAMP.ERROR,
WAMP.CALL,
Expand Down
10 changes: 8 additions & 2 deletions lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,17 @@ function Router(options) {
this.emit('RPCUnregistered', [uri])
};

this.callrpc = function(uri, args, callback) {
this.callrpc = function(uri, args, callback, session) {
if (typeof this.getrpc(uri) !== 'undefined') {
var invId = tools.randomId();
_pending[invId] = callback;
this.getrpc(uri).apply(this ,[invId, args]);
args.unshift(invId);

if (session) {
args.push(session);
}

this.getrpc(uri).apply(this ,args);
return true;
} else {
return false;
Expand Down
3 changes: 3 additions & 0 deletions lib/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ function Session (router, wsclient) {
"] " + msg;
log.trace(trace);
}.bind(this);

this.client = wsclient;

this.register = function (uri) {
var registrationId = util.randomId();
_registeredUris[registrationId] = uri;
Expand Down