You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-28 05:03:59 +03:00
Correct/improve comments about sync states
This commit is contained in:
@@ -3038,21 +3038,26 @@ module.exports.CRYPTO_ENABLED = CRYPTO_ENABLED;
|
|||||||
/**
|
/**
|
||||||
* Fires whenever the SDK's syncing state is updated. The state can be one of:
|
* Fires whenever the SDK's syncing state is updated. The state can be one of:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>PREPARED : The client has synced with the server at least once and is
|
*
|
||||||
|
* <li>PREPARED: The client has synced with the server at least once and is
|
||||||
* ready for methods to be called on it. This will be immediately followed by
|
* ready for methods to be called on it. This will be immediately followed by
|
||||||
* a state of SYNCING. <i>This is the equivalent of "syncComplete" in the
|
* a state of SYNCING. <i>This is the equivalent of "syncComplete" in the
|
||||||
* previous API.</i></li>
|
* previous API.</i></li>
|
||||||
|
*
|
||||||
* <li>SYNCING : The client is currently polling for new events from the server.
|
* <li>SYNCING : The client is currently polling for new events from the server.
|
||||||
* This will be called <i>after</i> processing latest events from a sync.</li>
|
* This will be called <i>after</i> processing latest events from a sync.</li>
|
||||||
|
*
|
||||||
* <li>ERROR : The client has had a problem syncing with the server. If this is
|
* <li>ERROR : The client has had a problem syncing with the server. If this is
|
||||||
* called <i>before</i> PREPARED then there was a problem performing the initial
|
* called <i>before</i> PREPARED then there was a problem performing the initial
|
||||||
* sync. If this is called <i>after</i> PREPARED then there was a problem polling
|
* sync. If this is called <i>after</i> PREPARED then there was a problem polling
|
||||||
* the server for updates. This may be called multiple times even if the state is
|
* the server for updates. This may be called multiple times even if the state is
|
||||||
* already ERROR. <i>This is the equivalent of "syncError" in the previous
|
* already ERROR. <i>This is the equivalent of "syncError" in the previous
|
||||||
* API.</i></li>
|
* API.</i></li>
|
||||||
* <li>RECONNECTING: The sync connedtion has dropped, but not in a way that should
|
*
|
||||||
* be considered erroneous.
|
* <li>RECONNECTING: The sync connedtion has dropped, but not (yet) in a way that
|
||||||
|
* should be considered erroneous.
|
||||||
* </li>
|
* </li>
|
||||||
|
*
|
||||||
* <li>STOPPED: The client has stopped syncing with server due to stopClient
|
* <li>STOPPED: The client has stopped syncing with server due to stopClient
|
||||||
* being called.
|
* being called.
|
||||||
* </li>
|
* </li>
|
||||||
@@ -3062,32 +3067,46 @@ module.exports.CRYPTO_ENABLED = CRYPTO_ENABLED;
|
|||||||
* +---->STOPPED
|
* +---->STOPPED
|
||||||
* |
|
* |
|
||||||
* +----->PREPARED -------> SYNCING <--+
|
* +----->PREPARED -------> SYNCING <--+
|
||||||
* | ^ ^ |
|
* | ^ | ^ |
|
||||||
* | | | |
|
* | | | | |
|
||||||
* | | V |
|
* | | V | |
|
||||||
* null ------+ | +-RECONNECTING<-+ |
|
* null ------+ | +--------RECONNECTING |
|
||||||
* | | V |
|
* | | V |
|
||||||
* +------->ERROR ---------------------+
|
* +------->ERROR ---------------------+
|
||||||
*
|
*
|
||||||
* NB: 'null' will never be emitted by this event.
|
* NB: 'null' will never be emitted by this event.
|
||||||
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
* Transitions:
|
* Transitions:
|
||||||
* <ul>
|
* <ul>
|
||||||
|
*
|
||||||
* <li><code>null -> PREPARED</code> : Occurs when the initial sync is completed
|
* <li><code>null -> PREPARED</code> : Occurs when the initial sync is completed
|
||||||
* first time. This involves setting up filters and obtaining push rules.
|
* first time. This involves setting up filters and obtaining push rules.
|
||||||
|
*
|
||||||
* <li><code>null -> ERROR</code> : Occurs when the initial sync failed first time.
|
* <li><code>null -> ERROR</code> : Occurs when the initial sync failed first time.
|
||||||
|
*
|
||||||
* <li><code>ERROR -> PREPARED</code> : Occurs when the initial sync succeeds
|
* <li><code>ERROR -> PREPARED</code> : Occurs when the initial sync succeeds
|
||||||
* after previously failing.
|
* after previously failing.
|
||||||
|
*
|
||||||
* <li><code>PREPARED -> SYNCING</code> : Occurs immediately after transitioning
|
* <li><code>PREPARED -> SYNCING</code> : Occurs immediately after transitioning
|
||||||
* to PREPARED. Starts listening for live updates rather than catching up.
|
* to PREPARED. Starts listening for live updates rather than catching up.
|
||||||
* <li><code>SYNCING -> ERROR</code> : Occurs the first time a client cannot perform a
|
*
|
||||||
* live update.
|
* <li><code>SYNCING -> RECONNECTING</code> : Occurs when the live update fails.
|
||||||
|
*
|
||||||
|
* <li><code>RECONNECTING -> RECONNECTING</code> : Can occur if the update calls
|
||||||
|
* continue to fail, but the keepalive calls (to /versions) succeed.
|
||||||
|
*
|
||||||
|
* <li><code>RECONNECTING -> ERROR</code> : Occurs when the keepalive call also fails
|
||||||
|
*
|
||||||
* <li><code>ERROR -> SYNCING</code> : Occurs when the client has performed a
|
* <li><code>ERROR -> SYNCING</code> : Occurs when the client has performed a
|
||||||
* live update after having previously failed.
|
* live update after having previously failed.
|
||||||
* <li><code>ERROR -> ERROR</code> : Occurs when the client has failed to sync
|
*
|
||||||
|
* <li><code>ERROR -> ERROR</code> : Occurs when the client has failed to keepalive
|
||||||
* for a second time or more.</li>
|
* for a second time or more.</li>
|
||||||
|
*
|
||||||
* <li><code>SYNCING -> SYNCING</code> : Occurs when the client has performed a live
|
* <li><code>SYNCING -> SYNCING</code> : Occurs when the client has performed a live
|
||||||
* update. This is called <i>after</i> processing.</li>
|
* update. This is called <i>after</i> processing.</li>
|
||||||
|
*
|
||||||
* <li><code>* -> STOPPED</code> : Occurs once the client has stopped syncing or
|
* <li><code>* -> STOPPED</code> : Occurs once the client has stopped syncing or
|
||||||
* trying to sync after stopClient has been called.</li>
|
* trying to sync after stopClient has been called.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
|
|||||||
@@ -882,7 +882,7 @@ SyncApi.prototype._processSyncResponse = function(syncToken, data) {
|
|||||||
* @param {number} delay How long to delay until the first poll.
|
* @param {number} delay How long to delay until the first poll.
|
||||||
* defaults to a short, randomised interval (to prevent
|
* defaults to a short, randomised interval (to prevent
|
||||||
* tightlooping if /versions succeeds but /sync etc. fail).
|
* tightlooping if /versions succeeds but /sync etc. fail).
|
||||||
* @return {promise}
|
* @return {promise} which resolves once the connection returns
|
||||||
*/
|
*/
|
||||||
SyncApi.prototype._startKeepAlives = function(delay) {
|
SyncApi.prototype._startKeepAlives = function(delay) {
|
||||||
if (delay === undefined) {
|
if (delay === undefined) {
|
||||||
@@ -908,7 +908,11 @@ SyncApi.prototype._startKeepAlives = function(delay) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Make a dummy call to /_matrix/client/versions, to see if the HS is
|
||||||
|
* reachable.
|
||||||
*
|
*
|
||||||
|
* On failure, schedules a call back to itself. On success, resolves
|
||||||
|
* this._connectionReturnedDefer.
|
||||||
*/
|
*/
|
||||||
SyncApi.prototype._pokeKeepAlive = function() {
|
SyncApi.prototype._pokeKeepAlive = function() {
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|||||||
Reference in New Issue
Block a user