Repository navigation
Expand file tree
/
Copy pathsubscriptions.txt
More file actions
71 lines (70 loc) · 2.19 KB
/
Copy pathsubscriptions.txt
File metadata and controls
71 lines (70 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# Two connections, A and B, to one fresh links server: subscriptions.
#
# Both ports replay it against their own server, in the text protocol and in
# the binary protocol with every option (csharp: SubscriptionsTests, rust:
# subscriptions_tests), and so does the JavaScript client
# (js/client/test/conformance).
#
# `A> request` is a request on connection A; the lines up to the next `A>`,
# `B>`, `A<` or `B<` are its reply, and `! message` is an error reply.
# `A< (notify: n)` is a document the server pushed to A without being asked:
# `(notify: n)` and the lines after it, one `(before) (after)` change each.
#
# Every push is written before any later reply on its connection, so after the
# reply to a request on a connection, that connection has no push left to read
# that this conversation does not list before the request.
# A asks for every change of every link.
A> (subscribe: (* * *))
(subscription: 1)
B> (create: (0 0))
() ((1: 0 0))
A< (notify: 1)
() ((1: 0 0))
# Subscriptions are numbered per connection, from 1.
B> (subscribe: (2))
(subscription: 1)
# A connection is not told about its own writes.
A> (create: (1 1))
() ((2: 1 1))
B< (notify: 1)
() ((2: 1 1))
# The restriction is a pattern, like the one of (each: ...); a change is
# pushed once per subscription it fits, in the order of the subscriptions.
A> (subscribe: (* 1 *))
(subscription: 2)
B> (update: (1 1 2))
((1: 0 0)) ((1: 1 2))
A< (notify: 1)
((1: 0 0)) ((1: 1 2))
# Each side is kept only when it fits the subscription: a link that comes
# into the pattern arrives as a creation...
A< (notify: 2)
() ((1: 1 2))
B> (update: (1 2 2))
((1: 1 2)) ((1: 2 2))
A< (notify: 1)
((1: 1 2)) ((1: 2 2))
# ...and a link that leaves it as a deletion.
A< (notify: 2)
((1: 1 2)) ()
# Substitution queries notify like operations do.
B> () ((1 2))
() ((3: 1 2))
A< (notify: 1)
() ((3: 1 2))
A< (notify: 2)
() ((3: 1 2))
# Unsubscribing answers nothing, even for a number that is not subscribed.
A> (unsubscribe: 2)
A> (unsubscribe: 7)
B> (update: (2 2 1))
((2: 1 1)) ((2: 2 1))
A< (notify: 1)
((2: 1 1)) ((2: 2 1))
A> (unsubscribe: 1)
B> (unsubscribe: 1)
# Nobody is subscribed any more: nothing is pushed.
B> (update: (2 0 0))
((2: 2 1)) ((2: 0 0))
A> (count: ())
(count: 3)