From 27844c9a20bd5b413fd76813d24f6d5c1dd19ea6 Mon Sep 17 00:00:00 2001 From: Hanno Cornelius <68783915+jm-clius@users.noreply.github.com> Date: Wed, 31 Mar 2021 17:06:20 +0200 Subject: [PATCH] Specify chat2 message format (#440) * Specify chat2 message format * Clarify payload is UTF8 encoded --- docs/tutorial/chat2.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/tutorial/chat2.md b/docs/tutorial/chat2.md index a4c347087..37be9c636 100644 --- a/docs/tutorial/chat2.md +++ b/docs/tutorial/chat2.md @@ -68,4 +68,18 @@ This will bypass the random peer selection process and connect to the specified | --- | --- | | `/help` | displays available in-chat commands | | `/connect` | interactively connect to a new peer | -| `/nick` | change nickname for current chat session | \ No newline at end of file +| `/nick` | change nickname for current chat session | + +## `chat2` message protobuf format + +Each `chat2` message is encoded as follows + +```protobuf +message Chat2Message { + uint64 timestamp = 1; + string nick = 2; + bytes payload = 3; +} +``` + +where `timestamp` is the Unix timestamp of the message, `nick` is the relevant `chat2` user's selected nickname and `payload` is the actual chat message being sent. The `payload` is the byte array representation of a UTF8 encoded string.