Skip to content
This repository has been archived by the owner on Mar 31, 2023. It is now read-only.

Commit

Permalink
Merge pull request #21 from azuqua/add-subscribe-callback
Browse files Browse the repository at this point in the history
feat: add subscribe callback
  • Loading branch information
richardheng-okta authored Oct 19, 2021
2 parents 46625eb + 4de4814 commit dac71f1
Show file tree
Hide file tree
Showing 4 changed files with 4,183 additions and 6 deletions.
10 changes: 8 additions & 2 deletions clients/browser/tokensockjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
this._socket.send(JSON.stringify(data));
};

Monitor.prototype.handleResponse = function(data){
Monitor.prototype.callCallback = function(data){
var fn = null;
if(data.rpc && data.uuid)
fn = this._inTransit[data.rpc][data.uuid];
Expand All @@ -107,7 +107,12 @@
delete this._inTransit[data.rpc][data.uuid];
if(Object.size(this._inTransit[data.rpc]) === 0)
delete this._inTransit[data.rpc];
}if(data.channel){
}
};

Monitor.prototype.handleResponse = function(data){
this.callCallback(data);
if (data.channel) {
this._emitter.emit("message", data.channel, data.message);
}
};
Expand All @@ -129,6 +134,7 @@
var handleInternal = function(instance, command, data){
if(command === "subscribe"){
instance._channels[data.channel] = true;
instance._monitor.callCallback(data);
}else if(command === "unsubscribe"){
delete instance._channels[data.channel];
}else if(command === "rpc"){
Expand Down
2 changes: 1 addition & 1 deletion clients/browser/tokensockjs.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit dac71f1

Please sign in to comment.