mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-27 15:45:48 +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) {
|
||||
self._set_state('online');
|
||||
|
||||
// Note, we could get disconnected before this goes through.
|
||||
self._server_subscribe(); // Automatically subscribe.
|
||||
}
|
||||
@@ -493,6 +491,10 @@ Remote.prototype._connect_message = function (ws, json) {
|
||||
this.emit('ledger_closed', message);
|
||||
break;
|
||||
|
||||
case 'serverStatus':
|
||||
this._set_state(message.server_status === 'ok' ? 'online' : 'offline');
|
||||
break;
|
||||
|
||||
// All other messages
|
||||
default:
|
||||
if (this.trace) utils.logObject("remote: "+message.type+": %s", message);
|
||||
@@ -852,6 +854,10 @@ Remote.prototype._server_subscribe = function () {
|
||||
self.emit('ledger_closed', message);
|
||||
}
|
||||
|
||||
if (message.server_status === "ok") {
|
||||
self._set_state('online');
|
||||
}
|
||||
|
||||
self.emit('subscribed');
|
||||
})
|
||||
.request();
|
||||
|
||||
Reference in New Issue
Block a user