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

Commit 98a9db6

Browse files
Merge pull request #18 from azuqua/add-subscribe-callback
feat: support subscribe callbacks
2 parents 267816f + 73c76fc commit 98a9db6

File tree

4 files changed

+1612
-5
lines changed

4 files changed

+1612
-5
lines changed

lib/external.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ module.exports = {
8484
clearInterval(this._cleanupTimer);
8585
},
8686

87-
subscribe: function(socket, channel){
87+
subscribe: function(socket, channel, message){
8888
if(this.pubsubClient){
8989
this._debug("Subscribing socket", socket.sid, channel);
9090
if(!this._channels[channel]){
@@ -95,7 +95,7 @@ module.exports = {
9595
if(!socket.channels)
9696
socket.channels = {};
9797
socket.channels[channel] = true;
98-
utils.sync(socket, "subscribe", { channel: channel });
98+
utils.sync(socket, "subscribe", Object.assign({}, message, { channel: channel }));
9999
}
100100
},
101101

lib/rpc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = function(socket, message, callback){
1616
if(error || !allowed)
1717
callback(error || "Forbidden");
1818
else
19-
self.subscribe(socket, message.req.channel);
19+
self.subscribe(socket, message.req.channel, message);
2020
});
2121
break;
2222
case "_unsubscribe":

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "node-token-sockjs",
33
"description": "A wrapper around express, sockjs-node, and redis that provides token based authentication, a websocket based rpc-like abstraction, and an optional publish subscribe interface.",
4-
"version": "3.0.0",
4+
"version": "3.0.1",
55
"author": "Azuqua",
66
"keywords": [
77
"azuqua",
@@ -44,7 +44,7 @@
4444
"devDependencies": {
4545
"chai": "^1.9.1",
4646
"express": "~3.4.8",
47-
"grunt": "~0.4.2",
47+
"grunt": "^1.4.1",
4848
"grunt-contrib-clean": "~0.5.0",
4949
"grunt-contrib-jshint": "~0.8.0",
5050
"grunt-mocha-test": "~0.9.4",

0 commit comments

Comments
 (0)