Fires when the client .well-known info is fetched. The payload is the JSON object (see IClientWellKnown) returned by the server
Fires whenever a Room is removed. This will fire when you forget a room. This event is experimental and may change. The payload is the roomId of the deleted room.
Fires whenever the SDK receives a new event.
This is only fired for live events received via /sync - it is not fired for events received over context, search, or pagination APIs.
The payload is the matrix event which caused this event to fire.
Fires whenever the SDK receives a new (potentially decrypted) to-device message. The payload is the to-device message and the encryption info for that message (ReceivedToDeviceMessage).
Fires whenever a new Room is added. This will fire when you are invited to a room, as well as when you join a room. This event is experimental and may change.
The payload is the newly created room, fully populated.
Fires whenever the SDK's syncing state is updated. The state can be one of:
NB: 'null' will never be emitted by this event.
Transitions:
<ul>
<li>`null -> PREPARED` : Occurs when the initial sync is completed
first time. This involves setting up filters and obtaining push rules.
<li>`null -> ERROR` : Occurs when the initial sync failed first time.
<li>`ERROR -> PREPARED` : Occurs when the initial sync succeeds
after previously failing.
<li>`PREPARED -> SYNCING` : Occurs immediately after transitioning
to PREPARED. Starts listening for live updates rather than catching up.
<li>`SYNCING -> RECONNECTING` : Occurs when the live update fails.
<li>`RECONNECTING -> RECONNECTING` : Can occur if the update calls
continue to fail, but the keepalive calls (to /versions) succeed.
<li>`RECONNECTING -> ERROR` : Occurs when the keepalive call also fails
<li>`ERROR -> SYNCING` : Occurs when the client has performed a
live update after having previously failed.
<li>`ERROR -> ERROR` : Occurs when the client has failed to keepalive
for a second time or more.</li>
<li>`SYNCING -> SYNCING` : Occurs when the client has performed a live
update. This is called <i>after</i> processing.</li>
<li>`* -> STOPPED` : Occurs once the client has stopped syncing or
trying to sync after stopClient has been called.</li>
</ul>
The payloads consits of the following 3 parameters:
- state - An enum representing the syncing state. One of "PREPARED",
"SYNCING", "ERROR", "STOPPED".
- prevState - An enum representing the previous syncing state.
One of "PREPARED", "SYNCING", "ERROR", "STOPPED" <b>or null</b>.
matrixClient.on("sync", function(state, prevState, data) {
switch (state) {
case "ERROR":
// update UI to say "Connection Lost"
break;
case "SYNCING":
// update UI to remove any "Connection Lost" message
break;
case "PREPARED":
// the client instance is ready to be queried.
var rooms = matrixClient.getRooms();
break;
}
});
Use ReceivedToDeviceMessage. Fires whenever the SDK receives a new to-device event. The payload is the matrix event (MatrixEvent) which caused this event to fire.
This event is not supported anymore.
Fires if a to-device event is received that cannot be decrypted. Encrypted to-device events will (generally) use plain Olm encryption, in which case decryption failures are fatal: the event will never be decryptable, unlike Megolm encrypted events where the key may simply arrive later.
An undecryptable to-device event is therefore likely to indicate problems.
The payload is the undecyptable to-device event
Fires whenever new user-scoped account_data is added. The payload is a pair of event (MatrixEvent) describing the account_data just added, and the previous event, if known: