mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Stop lost connection message bouncing when not authed
This commit is contained in:
parent
9bbe0799bd
commit
f5d7903ecb
@ -17,6 +17,8 @@
|
||||
RED.comms = (function() {
|
||||
|
||||
var errornotification = null;
|
||||
var clearErrorTimer = null;
|
||||
|
||||
var subscriptions = {};
|
||||
var ws;
|
||||
function connectWS() {
|
||||
@ -26,8 +28,10 @@ RED.comms = (function() {
|
||||
ws = new WebSocket(path);
|
||||
ws.onopen = function() {
|
||||
if (errornotification) {
|
||||
clearErrorTimer = setTimeout(function() {
|
||||
errornotification.close();
|
||||
errornotification = null;
|
||||
},1000);
|
||||
}
|
||||
var auth_tokens = RED.settings.get("auth-tokens");
|
||||
if (auth_tokens) {
|
||||
@ -60,6 +64,9 @@ RED.comms = (function() {
|
||||
ws.onclose = function() {
|
||||
if (errornotification == null) {
|
||||
errornotification = RED.notify("<b>Error</b>: Lost connection to server","error",true);
|
||||
} else if (clearErrorTimer) {
|
||||
clearTimeout(clearErrorTimer);
|
||||
clearErrorTimer = null;
|
||||
}
|
||||
setTimeout(connectWS,1000);
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ var bearerStrategy = function (accessToken, done) {
|
||||
Tokens.get(accessToken).then(function(token) {
|
||||
if (token) {
|
||||
Users.get(token.user).then(function(user) {
|
||||
console.log(user);
|
||||
if (user) {
|
||||
done(null,{username:user.username},{scope:token.scope});
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user