Comparing version 0.25.1 to 0.26.0
@@ -46,9 +46,12 @@ // Generated by LiveScript 1.5.0 | ||
} | ||
ExoRelay.prototype.send = function(messageName, payload, replyHandler){ | ||
ExoRelay.prototype.send = function(messageName, payload, options, replyHandler){ | ||
var message; | ||
switch (false) { | ||
case !(replyHandler && typeof replyHandler !== 'function'): | ||
if (typeof options !== 'object') { | ||
replyHandler = options; | ||
options = {}; | ||
} | ||
if (replyHandler && typeof replyHandler !== 'function') { | ||
return this.emit('error', Error('The reply handler given to ExoRelay#send must be a function')); | ||
} | ||
message = this.websocketConnector.send(messageName, payload); | ||
message = this.websocketConnector.send(messageName, payload, options); | ||
if (replyHandler) { | ||
@@ -65,3 +68,3 @@ this.messageHandler.registerReplyHandler(message.activityId, replyHandler); | ||
return this.messageHandler.handleRequest(requestData, { | ||
reply: this.websocketConnector.replyMethodFor(requestData.activityId, requestData.auth), | ||
reply: this.websocketConnector.replyMethodFor(requestData.activityId, requestData.auth, requestData.isSecurity), | ||
send: this.send | ||
@@ -68,0 +71,0 @@ }); |
@@ -26,3 +26,3 @@ // Generated by LiveScript 1.5.0 | ||
this.websocketConnector.send = sinon.stub(); | ||
return this.replyMethod = this.websocketConnector.replyMethodFor('123', '1'); | ||
return this.replyMethod = this.websocketConnector.replyMethodFor('123', '1', true); | ||
}); | ||
@@ -35,3 +35,4 @@ it('returns a function that calls @send prebound to the response id', function(){ | ||
activityId: '123', | ||
auth: '1' | ||
auth: '1', | ||
isSecurity: true | ||
} | ||
@@ -38,0 +39,0 @@ ]); |
@@ -42,3 +42,3 @@ // Generated by LiveScript 1.5.0 | ||
}; | ||
WebSocketConnector.prototype.replyMethodFor = function(activityId, auth){ | ||
WebSocketConnector.prototype.replyMethodFor = function(activityId, auth, isSecurity){ | ||
var this$ = this; | ||
@@ -53,3 +53,4 @@ switch (false) { | ||
activityId: activityId, | ||
auth: auth | ||
auth: auth, | ||
isSecurity: isSecurity | ||
}); | ||
@@ -82,2 +83,5 @@ }; | ||
} | ||
if (options.isSecurity) { | ||
requestData.isSecurity = options.isSecurity; | ||
} | ||
this.socket.send(JSON.stringify(requestData)); | ||
@@ -144,3 +148,4 @@ return this.lastSentMessage = requestData; | ||
id: req.id, | ||
auth: req.auth | ||
auth: req.auth, | ||
isSecurity: req.isSecurity | ||
}; | ||
@@ -147,0 +152,0 @@ }; |
{ | ||
"name": "exorelay", | ||
"version": "0.25.1", | ||
"version": "0.26.0", | ||
"author": "Kevin Goslar", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
23014
468