mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-06 03:31:00 +00:00
'Trying to reconnect..' in UI even though its connected
This commit is contained in:
@@ -30,6 +30,12 @@ module.exports = {
|
||||
WebapiUtils.getNodesDelta(AppStore.getCurrentTopologyUrl());
|
||||
},
|
||||
|
||||
openWebsocket: function() {
|
||||
AppDispatcher.dispatch({
|
||||
type: ActionTypes.OPEN_WEBSOCKET
|
||||
});
|
||||
},
|
||||
|
||||
closeWebsocket: function() {
|
||||
AppDispatcher.dispatch({
|
||||
type: ActionTypes.CLOSE_WEBSOCKET
|
||||
|
||||
@@ -4,6 +4,7 @@ module.exports = keymirror({
|
||||
CLICK_CLOSE_DETAILS: null,
|
||||
CLICK_NODE: null,
|
||||
CLICK_TOPOLOGY: null,
|
||||
OPEN_WEBSOCKER: null,
|
||||
CLOSE_WEBSOCKET: null,
|
||||
ENTER_EDGE: null,
|
||||
ENTER_NODE: null,
|
||||
|
||||
@@ -157,6 +157,11 @@ AppStore.registeredCallback = function(payload) {
|
||||
AppStore.emit(AppStore.CHANGE_EVENT);
|
||||
break;
|
||||
|
||||
case ActionTypes.OPEN_WEBSOCKET:
|
||||
websocketClosed = false;
|
||||
AppStore.emit(AppStore.CHANGE_EVENT);
|
||||
break;
|
||||
|
||||
case ActionTypes.CLOSE_WEBSOCKET:
|
||||
websocketClosed = true;
|
||||
AppStore.emit(AppStore.CHANGE_EVENT);
|
||||
|
||||
@@ -26,6 +26,10 @@ function createWebsocket(topologyUrl) {
|
||||
|
||||
socket = new WebSocket(WS_URL + topologyUrl + '/ws?t=' + updateFrequency);
|
||||
|
||||
socket.onopen = function() {
|
||||
AppActions.openWebsocket();
|
||||
};
|
||||
|
||||
socket.onclose = function() {
|
||||
clearTimeout(reconnectTimer);
|
||||
socket = null;
|
||||
|
||||
Reference in New Issue
Block a user