mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-12-05 16:58:01 +00:00
Only consider a server connection with server_status == 'ok' as being 'online'.
This commit is contained in:
@@ -412,8 +412,6 @@ Remote.prototype._connect_start = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (self.online_target) {
|
if (self.online_target) {
|
||||||
self._set_state('online');
|
|
||||||
|
|
||||||
// Note, we could get disconnected before this goes through.
|
// Note, we could get disconnected before this goes through.
|
||||||
self._server_subscribe(); // Automatically subscribe.
|
self._server_subscribe(); // Automatically subscribe.
|
||||||
}
|
}
|
||||||
@@ -493,6 +491,10 @@ Remote.prototype._connect_message = function (ws, json) {
|
|||||||
this.emit('ledger_closed', message);
|
this.emit('ledger_closed', message);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'serverStatus':
|
||||||
|
this._set_state(message.server_status === 'ok' ? 'online' : 'offline');
|
||||||
|
break;
|
||||||
|
|
||||||
// All other messages
|
// All other messages
|
||||||
default:
|
default:
|
||||||
if (this.trace) utils.logObject("remote: "+message.type+": %s", message);
|
if (this.trace) utils.logObject("remote: "+message.type+": %s", message);
|
||||||
@@ -852,6 +854,10 @@ Remote.prototype._server_subscribe = function () {
|
|||||||
self.emit('ledger_closed', message);
|
self.emit('ledger_closed', message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (message.server_status === "ok") {
|
||||||
|
self._set_state('online');
|
||||||
|
}
|
||||||
|
|
||||||
self.emit('subscribed');
|
self.emit('subscribed');
|
||||||
})
|
})
|
||||||
.request();
|
.request();
|
||||||
|
|||||||
Reference in New Issue
Block a user