1
2//////////////////////////////////////////////////////////////////////////////
3//
4//   FlatBuffers schema for WAMP v2 messages
5//   Copyright (c) Crossbar.io Technologies GmbH and contributors
6//   Licensed under the MIT License (MIT)
7//
8//////////////////////////////////////////////////////////////////////////////
9
10include "types.fbs";
11
12namespace wamp.proto;
13
14
15// SUBSCRIBE message (message_type = 32): [SUBSCRIBE, Request|id, Options|dict, Topic|uri]
16table Subscribe
17{
18    // The WAMP request ID of this request.
19    request: uint64 (key);
20
21    // The WAMP or application URI of the PubSub topic the event should be published to.
22    topic: string (required, uri_pattern);
23
24    // The topic matching method to be used for the subscription.
25    match: Match = EXACT;
26
27    // Whether the client wants the retained message we may have along with the subscription.
28    get_retained: bool;
29}
30
31
32// SUBSCRIBED message (message_type = 33): [SUBSCRIBED, SUBSCRIBE.Request|id, Subscription|id]
33table Subscribed
34{
35    // The request ID of the original SUBSCRIBE request.
36    request: uint64 (key);
37
38    // The subscription ID for the subscribed topic (or topic pattern).
39    subscription: uint64;
40}
41
42
43// UNSUBSCRIBE message (message_type = 34): [UNSUBSCRIBE, Request|id, SUBSCRIBED.Subscription|id]
44table Unsubscribe
45{
46    // The WAMP request ID of this request.
47    request: uint64 (key);
48
49    // The subscription ID for the subscription to unsubscribe from.
50    subscription: uint64;
51}
52
53
54// UNSUBSCRIBED message (message_type = 35): [UNSUBSCRIBED, UNSUBSCRIBE.Request|id, Details|dict]
55table Unsubscribed
56{
57    // The request ID of the original UNSUBSCRIBE request or 0 if the router triggered the unsubscribe ("router subscription revocation signaling").
58    request: uint64 (key);
59
60    // If unsubscribe was actively triggered by router, the ID of the subscription revoked.
61    subscription: uint64;
62
63    // The reason (an URI) for an active (router initiated) revocation.
64    reason: string (uri);
65}
66
67
68// PUBLISH message (message_type = 16): [PUBLISH, Request|id, Options|dict, Topic|uri, Payload|binary]
69table Publish
70{
71    // The WAMP request ID of this request.
72    request: uint64 (key);
73
74    // The WAMP or application URI of the PubSub topic the event should be published to.
75    topic: string (required, uri);
76
77    /// Positional values for application-defined event payload.
78    args: [uint8];
79
80    /// Keyword values for application-defined event payload.
81    kwargs: [uint8];
82
83    /// Alternative, transparent payload. If given, ``args`` and ``kwargs`` must be left unset.
84    payload: [uint8];
85
86    // The encoding algorithm that was used to encode the payload.
87    enc_algo: Payload;
88
89    // The payload object serializer that was used encoding the payload.
90    enc_serializer: Serializer;
91
92    // When using Payload.CRYPTOBOX, the public Cryptobox key of the key pair used for encrypting the payload.
93    enc_key: [uint8];
94
95    // If true, acknowledge the publication with a success or error response.
96    acknowledge: bool;
97
98    // If true, exclude the publisher from receiving the event, even if he is subscribed (and eligible).
99    exclude_me: bool = true;
100
101    // List of WAMP session IDs to exclude from receiving this event.
102    exclude: [uint64];
103
104    // List of WAMP authids to exclude from receiving this event.
105    exclude_authid: [string] (principal);
106
107    // List of WAMP authroles to exclude from receiving this event.
108    exclude_authrole: [string] (principal);
109
110    // List of WAMP session IDs eligible to receive this event.
111    eligible: [uint64];
112
113    // List of WAMP authids eligible to receive this event.
114    eligible_authid: [string] (principal);
115
116    // List of WAMP authroles eligible to receive this event.
117    eligible_authrole: [string] (principal);
118
119    // If true, request the broker retain this event.
120    retain: bool;
121
122    // When this message is forwarded in router-to-router traffic, the route of the message in tuples of (session, authid, authrole) beginning with the publisher session followed by a series of router-link sessions.
123    forward_for: [Principal];
124}
125
126
127// PUBLISHED message (message_type = 17): [PUBLISHED, PUBLISH.Request|id, Publication|id]
128table Published
129{
130    // The request ID of the original PUBLISH request.
131    request: uint64 (key);
132
133    // The publication ID for the published event.
134    publication: uint64;
135}
136
137
138// EVENT message (message_type = 36): [EVENT, SUBSCRIBED.Subscription|id, PUBLISHED.Publication|id, Details|dict, PUBLISH.Payload|binary]
139table Event
140{
141    // The subscription ID this event is dispatched under.
142    subscription: uint64;
143
144    // The publication ID of the dispatched event.
145    publication: uint64;
146
147    /// Positional values for application-defined event payload.
148    args: [uint8];
149
150    /// Keyword values for application-defined event payload.
151    kwargs: [uint8];
152
153    /// Alternative, transparent payload. If given, ``args`` and ``kwargs`` must be left unset.
154    payload: [uint8];
155
156    // The encoding algorithm that was used to encode the payload.
157    enc_algo: Payload;
158
159    // The payload object serializer that was used encoding the payload.
160    enc_serializer: Serializer;
161
162    // When using Payload.CRYPTOBOX, the public Cryptobox key of the key pair used for encrypting the payload.
163    enc_key: [uint8];
164
165    // The WAMP session ID of the pubisher. Only filled when the publisher is disclosed.
166    publisher: uint64;
167
168    // The WAMP authrole of the publisher. Only filled when publisher is disclosed.
169    publisher_authid: string (principal);
170
171    // The WAMP authrole of the publisher. Only filled when publisher is disclosed.
172    publisher_authrole: string (principal);
173
174    // For pattern-based subscriptions, the event MUST contain the actual topic published to.
175    topic: string (uri);
176
177    // Whether the message was retained by the broker on the topic, rather than just published.
178    retained: bool;
179
180    // Hint to request acknowledgement of the reception of this Event by a subscriber.
181    acknowledge: bool;
182
183    // When this message is forwarded in router-to-router traffic, the route of the message in tuples of (session, authid, authrole) beginning with the publisher session followed by a series of router-link sessions.
184    forward_for: [Principal];
185}
186
187
188// EVENT_RECEIVED message (message_type = 37): [EVENT_RECEIVED, EVENT.Publication|id, Details|dict, Payload|binary]
189table EventReceived
190{
191    // The publication ID of the event that was received, and that is acknowledged.
192    publication: uint64;
193
194    // Raw application payload: error arguments. This might be encrypted (with Payload==Payload.CRYPTOBOX), and is serialized according to enc_serializer.
195    payload: [uint8];
196
197    // The encoding algorithm that was used to encode the payload.
198    enc_algo: Payload;
199
200    // The payload object serializer that was used encoding the payload.
201    enc_serializer: Serializer;
202
203    // When using Payload.CRYPTOBOX, the public Cryptobox key of the key pair used for encrypting the payload.
204    enc_key: [uint8];
205}
206
207
208// SUBSCRIBER_RECEIVED message (message_type = 38): [SUBSCRIBER_RECEIVED, EVENT_RECEIVED.Publication|id, Details|dict, EVENT_RECEIVED.Payload|binary]
209table SubscriberReceived
210{
211    // The publication ID of the event that was received, and that is acknowledged.
212    publication: uint64;
213
214    // The WAMP session ID of the subscriber. Only filled when the subscriber is disclosed.
215    subscriber: uint64;
216
217    // The WAMP authrole of the subscriber. Only filled when subscriber is disclosed.
218    subscriber_authid: string (principal);
219
220    // The WAMP authrole of the subscriber. Only filled when subscriber is disclosed.
221    subscriber_authrole: string (principal);
222
223    // Raw application payload: error arguments. This might be encrypted (with Payload==Payload.CRYPTOBOX), and is serialized according to enc_serializer.
224    payload: [uint8];
225
226    // The encoding algorithm that was used to encode the payload.
227    enc_algo: Payload;
228
229    // The payload object serializer that was used encoding the payload.
230    enc_serializer: Serializer;
231
232    // When using Payload.CRYPTOBOX, the public Cryptobox key of the key pair used for encrypting the payload.
233    enc_key: [uint8];
234}
235