Skip to content

Commit 10bd1b5

Browse files
authored
Re-add timestamp massaging (#1094)
* Re-add timestamp massaging Per [MSC3316](matrix-org/matrix-spec-proposals#3316) * changelog
1 parent a91030f commit 10bd1b5

File tree

2 files changed

+33
-7
lines changed

2 files changed

+33
-7
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add timestamp massaging as per [MSC3316](https://github.com/matrix-org/matrix-spec-proposals/pull/3316).

content/application-service-api.md

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -300,13 +300,38 @@ An example request would be:
300300

301301
#### Timestamp massaging
302302

303-
Previous drafts of the Application Service API permitted application
304-
services to alter the timestamp of their sent events by providing a `ts`
305-
query parameter when sending an event. This API has been excluded from
306-
the first release due to design concerns, however some servers may still
307-
support the feature. Please visit [issue
308-
\#1585](https://github.com/matrix-org/matrix-doc/issues/1585) for more
309-
information.
303+
{{% added-in v="1.3" %}}
304+
305+
Application services can alter the timestamp associated with an event, allowing
306+
the application service to better represent the "real" time an event was sent
307+
at. While this doesn't affect the server-side ordering of the event, it can allow
308+
an application service to better represent when an event would have been sent/received
309+
at, such as in the case of bridges where the remote network might have a slight
310+
delay and the application service wishes to bridge the proper time onto the message.
311+
312+
When authenticating requests as an application service, the caller can append a `ts`
313+
query string argument to change the `origin_server_ts` of the resulting event. Attempting
314+
to set the timestamp to anything other than what is accepted by `origin_server_ts` should
315+
be rejected by the server as a bad request.
316+
317+
When not present, the server's behaviour is unchanged: the local system time of the server
318+
will be used to provide a timestamp, representing "now".
319+
320+
The `ts` query string argument is only valid on the following endpoints:
321+
322+
* [`PUT /rooms/{roomId}/send/{eventType}/{txnId}`](/client-server-api/#put_matrixclientv3roomsroomidsendeventtypetxnid)
323+
* [`PUT /rooms/{roomId}/state/{eventType}/{stateKey}`](/client-server-api/#put_matrixclientv3roomsroomidstateeventtypestatekey)
324+
325+
Other endpoints, such as `/kick`, do not support `ts`: instead, callers can use the
326+
`PUT /state` endpoint to mimic the behaviour of the other APIs.
327+
328+
{{% boxes/warning %}}
329+
Changing the time of an event does not change the server-side (DAG) ordering for the
330+
event. The event will still be appended at the tip of the DAG as though the timestamp
331+
was set to "now". Future MSCs, like [MSC2716](https://github.com/matrix-org/matrix-spec-proposals/pull/2716),
332+
are expected to provide functionality which can allow DAG order manipulation (for history
333+
imports and similar behaviour).
334+
{{% /boxes/warning %}}
310335

311336
#### Server admin style permissions
312337

0 commit comments

Comments
 (0)