Last active
August 29, 2015 14:15
-
-
Save guiltry/bafad017fc34ca4b8c30 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
socket.on('subscribe_public', function (m) { | |
socket.join(m.channel); | |
}); | |
socket.on('subscribe_private', function (m) { | |
if (m.jwt && is_valid_jwt(m.jwt)) { | |
socket.join(m.channel); | |
} | |
}); | |
// On redis publish event. | |
redis.sub.on('message', function(channel, message) { | |
msg = JSON.parse(message); | |
io_broadcast.in(msg.channel).emit(msg.event, msg.message); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment