Skip to content

Commit e76eb7d

Browse files
authored
Merge pull request #3 from afrind/draft-06
Update moq-chat to utiltize draft-06 features
2 parents 9870966 + c0b5df9 commit e76eb7d

File tree

1 file changed

+48
-77
lines changed

1 file changed

+48
-77
lines changed

draft-frindell-moq-chat.md

Lines changed: 48 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -55,115 +55,86 @@ receive messages published by others.
5555
Commonly used terms in this document are described below.
5656

5757

58-
# Catalog Format
59-
60-
The moq-chat catalog is used to determine the list of participants in the chat.
61-
The format is a text file with text delta encodings.
62-
63-
Object 0 in any Group is a complete list of the usernames of the participants in
64-
the chat at the time the Object was published, one per-line. The first line of
65-
Object 0 is the version of the catalog format specificaiton. The format
66-
described here is moq-chat catalog format version 1.
67-
68-
Object 0 Example:
69-
70-
~~~
71-
version=1
72-
alice
73-
bob
74-
charlie
75-
~~~
76-
77-
Any Object in a Group with sequence number higher than 0 is a delta encoding,
78-
with new participants prefaced with a '+' character and participants that have
79-
left the chat prefaced with a '-' character. Every delta encoding object MUST
80-
be applied for an endpoint to have a current list of participants.
81-
82-
Delta Encoding Exmaple:
83-
84-
~~~
85-
+daphne
86-
-bob
87-
~~~
88-
89-
Every username in the catalog MUST be unique. If an endpoint receives a catalog
90-
or delta encoding that would result in the same username more than once, it MUST
91-
close the session with an error.
92-
93-
Every object in a catalog group MUST be on a single stream, so that updates are
94-
delivered in order.
95-
9658
# Chat Operation
9759

98-
## MoQ Chat Server
60+
## MoQ Relay
9961

100-
The protocol requires that one entity operate as a chat server. The function
101-
of the server is to maintain the list of participants in the chat and publish
102-
catalog updates.
62+
The protocol requires a MoQ relay to act as a chat server. The relay maintains
63+
the set of connected clients that have announced a chat track.
10364

10465
## Chat ID
10566

10667
Every chat has a unique ID. The ID is a string of arbitrary length and uniquely
107-
identifies the chat. The creation of chat IDs and discovery of the server
108-
endpoint is out of the scope of this document.
68+
identifies the chat. The creation of chat IDs and discovery of the relay is
69+
out of the scope of this document.
10970

11071
## Track Names
11172

112-
The catalog for a given chat is available by subscribing to moq-chat/id.
73+
Each chat participant has a chat track. The namespace of the track is
74+
("moq-chat", \<id\>, \<user-id\>, \<device-id\>, \<timestamp\>) and the name
75+
track is "chat".
76+
77+
* id - the ID of the chatroom
78+
* user-id - the user ID
79+
* device-id - a unique identifier for each device for the user. This allows
80+
the same user to join the chat from multiple devices
81+
* timestamp - the timestamp in seconds when the track started, encoded as a
82+
string. This allows a stateless client to start publishing
83+
without accidentally overwriting a previously sent group and
84+
object.
85+
Note: the protocol will still function so long as each chat
86+
client selects a monotonically increasing number for this field.
87+
Using the common format described here could support future
88+
functionality like pulling chat history.
11389

11490
## Joining the Chat
11591

116-
To join the chat a participant sends a SUBSCRIBE message to moq-chat/id in order
117-
to get the participant list and subsequent participant updates. This SUBSCRIBE
118-
requires the AUTHORIZATION_INFO to contain the participant's ASCII string
119-
username. It is RECOMMENDED the participant request the catalog starting from
120-
the beginning of the current Group. The moq-chat server will reply with an
121-
SUBSCRIBE_OK if joining was successful or SUBSCRIBE_ERROR if the join failed.
92+
To join the chat a participant sends a SUBSCRIBE_NAMESPACE message to the relay
93+
with a namespace prefix ("moq-chat", \<id\>). MoQ Relays track the current
94+
state of all announced namespaces and namespace subscriptions, and forward any
95+
matching ANNOUNCE or UNANNOUNCE messages to interested endpoints.
12296

123-
The participant also sends an ANNOUNCE message to the server with a track
124-
namespace of moq-chat/id/participant/username, and an empty Track Name.
125-
126-
When a moq-chat server receives a SUBSCRIBE and sends an SUBSCRIBE OK, it MUST
127-
update the catalog. It can either publish a new Group with the updated
128-
particiant list, a delta encoding against the current Group, or both.
97+
The participant also sends an ANNOUNCE message for their chat track namespace.
12998

13099
## Subscribing to Chat Messages
131100

132-
After receiving the most recent catalog information, a client SHOULD subscribe
133-
to the track for each active participant.
134-
135-
Upon receiving a delta update removing a participant, a client SHOULD
136-
unsubscribe from that track if it had previously subscribed.
101+
When receiving an ANNOUNCE that matches the chat prefix, the client extracts the
102+
client's user-id, device-id and timestamp from the third, fourth and fifth tuple
103+
elements, respectively. The client SHOULD subscribe to the latest timestamp
104+
track for each (user-id, device-id) pair.
137105

138-
Upone receiving a delta update adding a participant, a client should subscribe
139-
to the new track.
106+
Upon receiving an UNANNOUNCE, a client SHOULD UNSUBSCRIBE from that
107+
matching track if it had previously subscribed.
140108

141109
## Chat Messages
142110

143111
Each chat message is sent in a new Group and new Object. The format of a chat
144-
chat message for version 1 catalogs is UTF-8 Encoded text. There is no limit to
145-
the length of a chat message beyond those imposed on QUIC streams.
112+
chat message this draft is UTF-8 Encoded text. There is no limit to
113+
the length of a chat message beyond those imposed on QUIC streams. Chat clients
114+
MUST send an END_OF_GROUP message for each Group.
115+
116+
The starting Group ID for each track starts at 0 and increments by 1. The
117+
Object ID for each chat message starts at 0 and increments by 1.
146118

147119
## Leaving the Chat
148120

149-
When a user leaves the chat, it would be nice if they could send a message
150-
indicating that their track is complete or no longer available, but the protocol
151-
has no such message (yet).
121+
When a user leaves the chat, they SHOULD send END_OF_TRACK_AND_GROUP, since
122+
they will start a new track if they rejoin.
152123

153-
When a server or relay detects a MOQT session has terminated, it MUST update the
154-
catalog and remove any participants that had sent ANNOUNCE messages on that
155-
session.
124+
If all publishers of a given namespace disconnect from the relay abruptly, the
125+
relay will send UNANNOUNCE messages matching SUBSCRIBE_NAMESPACE to interested
126+
clients.
156127

157128
## Stream Mapping
158129

159-
There is no prescription for how to map catalog or chat messages onto QUIC
160-
streams. Endpoints can choose to use one stream per track, one stream per group
161-
or one stream per object.
130+
The RECOMMENDED forwarding preference for the chat track is Subgroup, with all
131+
subgroup IDs set to 0, though clients MAY use other forwarding preferences at
132+
their discretion.
162133

163134
## Session Closure by the Server
164135

165-
If a client detects a MOQT session has been closed by the server, it assumes
166-
the server has exited or crashed, and does not attempt to reconnect.
136+
If a client detects a MOQT session has been closed by the relay, it assumes
137+
the relay has exited or crashed, and does not attempt to reconnect.
167138

168139
# Security Considerations
169140

0 commit comments

Comments
 (0)