Add auth awareness to comms channel

This commit is contained in:
Nick O'Leary
2014-11-12 13:21:59 +00:00
parent 982997c3df
commit 74e1ef0823
2 changed files with 51 additions and 8 deletions

View File

@@ -29,6 +29,10 @@ RED.comms = (function() {
errornotification.close();
errornotification = null;
}
var auth_tokens = RED.settings.get("auth-tokens");
if (auth_tokens) {
ws.send(JSON.stringify({auth:auth_tokens.access_token}));
}
for (var t in subscriptions) {
if (subscriptions.hasOwnProperty(t)) {
ws.send(JSON.stringify({subscribe:t}));