You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-07-30 04:23:07 +03:00
Mark events which fail to send.
This commit is contained in:
@ -11,5 +11,7 @@ New properties:
|
|||||||
|
|
||||||
New features:
|
New features:
|
||||||
* Local echo. When you send an event using the SDK it will immediately be
|
* Local echo. When you send an event using the SDK it will immediately be
|
||||||
added to the timeline with the event.status of `'sending'`. When the event is
|
added to the timeline with the event.status of `EventStatus.SENDING`. When
|
||||||
finally sent, this status will be removed.
|
the event is finally sent, this status will be removed.
|
||||||
|
* Not sent status. When an event fails to send using the SDK, it will have the
|
||||||
|
`event.status` of `EventStatus.NOT_SENT`.
|
||||||
|
@ -48,11 +48,11 @@ events for incoming data and state changes. Aside from wrapping the HTTP API, it
|
|||||||
that have just been sent will appear in the timeline as 'sending', until it
|
that have just been sent will appear in the timeline as 'sending', until it
|
||||||
completes. This is beneficial because it prevents there being a gap between
|
completes. This is beneficial because it prevents there being a gap between
|
||||||
hitting the send button and having the "remote echo" arrive.
|
hitting the send button and having the "remote echo" arrive.
|
||||||
|
- Mark messages which failed to send as not sent.
|
||||||
|
|
||||||
Later versions of the SDK will:
|
Later versions of the SDK will:
|
||||||
- Automatically retry requests to send messages due to network errors.
|
- Automatically retry requests to send messages due to network errors.
|
||||||
- Automatically retry requests to send messages due to rate limiting errors.
|
- Automatically retry requests to send messages due to rate limiting errors.
|
||||||
- Mark events' sent status (e.g. 'not sent').
|
|
||||||
- Handle queueing of messages.
|
- Handle queueing of messages.
|
||||||
- Handle pagination.
|
- Handle pagination.
|
||||||
- Expose a `RoomSummary` which would be suitable for a recents page.
|
- Expose a `RoomSummary` which would be suitable for a recents page.
|
||||||
|
@ -153,9 +153,12 @@ function printLine(event) {
|
|||||||
if (event.getSender() === myUserId) {
|
if (event.getSender() === myUserId) {
|
||||||
name = "Me";
|
name = "Me";
|
||||||
separator = ">>>";
|
separator = ">>>";
|
||||||
if (event.status === "sending") {
|
if (event.status === sdk.EventStatus.SENDING) {
|
||||||
separator = "...";
|
separator = "...";
|
||||||
}
|
}
|
||||||
|
else if (event.status === sdk.EventStatus.NOT_SENT) {
|
||||||
|
separator = " x ";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var body = "";
|
var body = "";
|
||||||
|
|
||||||
|
@ -274,6 +274,10 @@ MatrixClient.prototype.sendEvent = function(roomId, eventType, content, txnId,
|
|||||||
localEvent.status = null;
|
localEvent.status = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}, function(err) {
|
||||||
|
if (localEvent) {
|
||||||
|
localEvent.status = EventStatus.NOT_SENT;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
/** The {@link module:models/event.MatrixEvent|MatrixEvent} class. */
|
/** The {@link module:models/event.MatrixEvent|MatrixEvent} class. */
|
||||||
module.exports.MatrixEvent = require("./models/event").MatrixEvent;
|
module.exports.MatrixEvent = require("./models/event").MatrixEvent;
|
||||||
|
/** The {@link module:models/event.EventStatus|EventStatus} enum. */
|
||||||
|
module.exports.EventStatus = require("./models/event").EventStatus;
|
||||||
/** The {@link module:store/memory.MatrixInMemoryStore|MatrixInMemoryStore} class. */
|
/** The {@link module:store/memory.MatrixInMemoryStore|MatrixInMemoryStore} class. */
|
||||||
module.exports.MatrixInMemoryStore = require("./store/memory").MatrixInMemoryStore;
|
module.exports.MatrixInMemoryStore = require("./store/memory").MatrixInMemoryStore;
|
||||||
/** The {@link module:http-api.MatrixHttpApi|MatrixHttpApi} class. */
|
/** The {@link module:http-api.MatrixHttpApi|MatrixHttpApi} class. */
|
||||||
|
@ -12,11 +12,10 @@
|
|||||||
* @enum {string}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
module.exports.EventStatus = {
|
module.exports.EventStatus = {
|
||||||
UNKNOWN: "unknown",
|
/** The event was not sent and will no longer be retried. */
|
||||||
SENT: "sent",
|
|
||||||
NOT_SENT: "not_sent",
|
NOT_SENT: "not_sent",
|
||||||
SENDING: "sending",
|
/** The event is in the process of being sent. */
|
||||||
INCOMING: "incoming"
|
SENDING: "sending"
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user