|
|
|
@ -0,0 +1,68 @@
|
|
|
|
|
Sigils:
|
|
|
|
|
|
|
|
|
|
client-initiated
|
|
|
|
|
+INFORMATIVE (do not change state, casts)
|
|
|
|
|
!CAST
|
|
|
|
|
@ACKED/WITH-RESPONSE/CALL
|
|
|
|
|
(responses start with @ too)
|
|
|
|
|
?QUERY (=acked without state change)
|
|
|
|
|
(responses start with ? too)
|
|
|
|
|
(maybe even: c→s: ?QUEUE => s→c ?QUEUE song song song …; see continuations below)
|
|
|
|
|
|
|
|
|
|
server-initiated
|
|
|
|
|
$STATE
|
|
|
|
|
+INFORMATIVE
|
|
|
|
|
!CAST
|
|
|
|
|
If we ever need server to query clients, it might use * sigil ig (both ways). But the server should not have a need to…
|
|
|
|
|
|
|
|
|
|
additionally, responses keep sigils, so there are C→S sigils (@?), S→C sigils ($) and sigils with no replies (+!). Technically, $COMMANDS probably do not have replies either.
|
|
|
|
|
- the distinction between S→C $ and ! is that ! does not mutate internal state w.r.t. playing songs?
|
|
|
|
|
- Also +PING has reply in +PONG lol :-D
|
|
|
|
|
|
|
|
|
|
The timing/transaction semantics are as follows: each sigil forms its own queue. Responses to messages for each sigil are in order and for the time being, it is forbidden to send another message to the other party when a same-sigilled message is waiting for reply. On the other hand, messages with different sigils can be interleaved arbitrarily.
|
|
|
|
|
e.g. the following is a *valid* order of messages (note how the +COMMANDS are not technically linked, so they are interleaved completely arbitrarily):
|
|
|
|
|
C: @BROADCAST hello everyone
|
|
|
|
|
C: ?QUEUE
|
|
|
|
|
S: ?QUEUE citrónky amazonka
|
|
|
|
|
C: +PING
|
|
|
|
|
S: +A-COMMAND-JUST-FOR-EXAMPLE
|
|
|
|
|
S: +PONG
|
|
|
|
|
S: @ACK broadcast ok
|
|
|
|
|
C: @QUEUE markytánka
|
|
|
|
|
S: !MESSAGE hello everyone
|
|
|
|
|
S: @ACK markytánka added
|
|
|
|
|
S: $QUEUE ADDED markytánka
|
|
|
|
|
|
|
|
|
|
The standard protocol words are all low-ascii and uppercase and none of them start with X or Y; additionally, only interpunction are valid sigils. However, the protocol itself and esp. arguments of commands are UTF-8 (no BOM), so extensions may use letters as sigils, custom commands with existing sigils starting with X or Y. (It is probably a better idea to reuse sigils than to add new ones, it is very implementation defined as of now how to handle unknown sigils. (However, handling of unknown commands (except +COMMANDS) is done the same way :-D))
|
|
|
|
|
|
|
|
|
|
The expectation is that each side has a “router” that “sorts” commands according to their sigils to different parts of code. The router needs to listen ~all the time anyway (we have casts)
|
|
|
|
|
|
|
|
|
|
INFORMATIVE = can be safely ignored. STATE and CAST are very similar in s→c scenario, but only STATE needs to be kept (iow, s→c CASTs are only for side effects)
|
|
|
|
|
|
|
|
|
|
TODO: continuation: lines starting with - are continuation, the actual sigil is in the last message. If the next message does not follow in T_CONT = 100ms, the transaction did not happen at all?
|
|
|
|
|
- continued messages must be informative? (will probably be used as query responses anyway?)
|
|
|
|
|
ALTERNATIVE: ?-QUEUE song1 \n ?QUEUE song_last
|
|
|
|
|
- **alternative is better, because it allows message interleaving!**
|
|
|
|
|
|
|
|
|
|
Known commands
|
|
|
|
|
+PING/+PONG
|
|
|
|
|
?HELO <version?> [ident?]/?HELO <version?> [ident?]
|
|
|
|
|
!BYE/!KICKED
|
|
|
|
|
@QUEUE <path>
|
|
|
|
|
@CAPO <fret>
|
|
|
|
|
@ACK [optional info msg?] – universal reply to stuff.
|
|
|
|
|
|
|
|
|
|
@BROADCAST <message>/!MESSAGE <message>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
----
|
|
|
|
|
cmd reqs:
|
|
|
|
|
conn, disconn tracking
|
|
|
|
|
current song+capo tracking, querying the state, casting the state
|
|
|
|
|
queue management: add to queue, remove from queue, list the queue, maybe casting the queue
|
|
|
|
|
message broadcasting
|
|
|
|
|
service messages (rate limits)?
|
|
|
|
|
TODO: versioning?
|
|
|
|
|
|
|
|
|
|
FUTURE: proxying? – if we implement appl-layer mcast, we need to distinguish multiplexed users and directed vs broadcasted messages
|
|
|
|
|
- Wrap it in protocol layer: #PROXY user $COMMAND?
|