diff options
author | Tom Smeding <tom@tomsmeding.com> | 2021-02-10 10:15:24 +0100 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2021-02-10 12:04:24 +0100 |
commit | 8803632a5f9e36cc9a82b42bdc60280fc22a0270 (patch) | |
tree | 950c4920bd7713a0066a31bdbfb553e0c367bae9 | |
parent | 8c810b89cbdedfd72a1cb683cbdd96795876f083 (diff) |
protocol: Clarify timestamps
-rw-r--r-- | protocol.md | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/protocol.md b/protocol.md index 549ac01..5951f11 100644 --- a/protocol.md +++ b/protocol.md @@ -17,6 +17,10 @@ Preliminary definitions: - A _word_ is a string without spaces (ASCII 32) (and also without newlines). Note that the empty string is also a valid word. +Timestamps in the protocol, which indicate the time at which an event happened, +are represented as microseconds since the UNIX epoch. A valid timestamp is +always non-negative, i.e. at least 0. + There are three kinds of messages: commands from the client, command responses from the server, and push messages from the server (not to be confused with push _notifications_). These three kinds are described below. @@ -64,10 +68,9 @@ A _response_ from the server will be in one of the following forms: - `<tag> history_message <index:i64> <roomname:word> <user:word> <timestamp:i64> <msgid:i64> <replymsgid:i64> <message:string...>` - Part of the response to the client's `history` command. Index 0 is the oldest message; index (`<count>` - 1) (from the `history` response) is the - newest message in the fragment requested. Timestamps are microseconds since - the UNIX epoch. The reply message id is -1 if the message is a normal - message, or nonnegative if it is a reply to the referenced message in the - same room. + newest message in the fragment requested. The reply message id is -1 if the + message is a normal message, or nonnegative if it is a reply to the + referenced message in the same room. - `<tag> message <roomname:word> <user:word> <timestamp:i64> <msgid:i64> <replymsgid:i64> <message:string...>` - Response to the client's `get_message` command. This contains the information for a single message, as in `_push message` and the |