cent 4.0.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +93 -0
- data/MIGRATING.md +305 -0
- data/README.md +702 -155
- data/lib/cent/auto_batch.rb +305 -0
- data/lib/cent/batch.rb +209 -0
- data/lib/cent/broadcast.rb +117 -0
- data/lib/cent/client.rb +602 -216
- data/lib/cent/command.rb +64 -0
- data/lib/cent/endpoints.rb +191 -0
- data/lib/cent/errors.rb +392 -0
- data/lib/cent/generated/methods.rb +4226 -0
- data/lib/cent/generated/proxy_types.rb +1834 -0
- data/lib/cent/generated/types.rb +2844 -0
- data/lib/cent/handler.rb +179 -0
- data/lib/cent/http.rb +251 -0
- data/lib/cent/message.rb +52 -0
- data/lib/cent/pages.rb +165 -0
- data/lib/cent/payload.rb +93 -0
- data/lib/cent/proxy.rb +254 -0
- data/lib/cent/reply.rb +109 -0
- data/lib/cent/retry.rb +53 -0
- data/lib/cent/shared_poll.rb +61 -0
- data/lib/cent/token.rb +560 -0
- data/lib/cent/version.rb +2 -1
- data/lib/cent/wire.rb +222 -0
- data/lib/cent.rb +33 -5
- metadata +34 -44
- data/Gemfile +0 -15
- data/Rakefile +0 -12
- data/bin/console +0 -15
- data/bin/setup +0 -8
- data/cent.gemspec +0 -36
- data/lib/cent/error.rb +0 -46
- data/lib/cent/notary.rb +0 -105
|
@@ -0,0 +1,1834 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Code generated by gen/generate.rb from proto/proxy.proto. DO NOT EDIT.
|
|
4
|
+
|
|
5
|
+
module Cent
|
|
6
|
+
module Proxy
|
|
7
|
+
# FilterNode is a node of a publication tags filter expression. A leaf node
|
|
8
|
+
# compares one tag: it sets key, cmp and val or vals, and leaves op empty. A
|
|
9
|
+
# logical node combines its nodes: it sets op and nodes only.
|
|
10
|
+
#
|
|
11
|
+
# @!attribute [r] op
|
|
12
|
+
# @return [String] The logical operation. Empty for a leaf node. One of: and, or, not.
|
|
13
|
+
# @!attribute [r] key
|
|
14
|
+
# @return [String] The tag a leaf node compares.
|
|
15
|
+
# @!attribute [r] cmp
|
|
16
|
+
# @return [String] The comparison of a leaf node: ex is exists, nex does not exist,
|
|
17
|
+
# sw starts with, ew ends with, ct contains. One of: eq, neq, in, nin, ex,
|
|
18
|
+
# nex, sw, ew, ct, gt, gte, lt, lte.
|
|
19
|
+
# @!attribute [r] val
|
|
20
|
+
# @return [String] The value most comparisons compare the tag with.
|
|
21
|
+
# @!attribute [r] vals
|
|
22
|
+
# @return [Array<String>] The values "in" and "nin" compare the tag with.
|
|
23
|
+
# @!attribute [r] nodes
|
|
24
|
+
# @return [Array<FilterNode>] The operands of a logical node.
|
|
25
|
+
class FilterNode < Data.define(:op, :key, :cmp, :val, :vals, :nodes)
|
|
26
|
+
include Message
|
|
27
|
+
|
|
28
|
+
def initialize(
|
|
29
|
+
op: "",
|
|
30
|
+
key: "",
|
|
31
|
+
cmp: "",
|
|
32
|
+
val: "",
|
|
33
|
+
vals: [],
|
|
34
|
+
nodes: []
|
|
35
|
+
)
|
|
36
|
+
super
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# The message as Centrifugo reads it, fields at their zero value left out.
|
|
40
|
+
#
|
|
41
|
+
# @api private
|
|
42
|
+
def to_wire(where = "")
|
|
43
|
+
w = {}
|
|
44
|
+
Wire.put(w, "op", op, where, :str)
|
|
45
|
+
Wire.put(w, "key", key, where, :str)
|
|
46
|
+
Wire.put(w, "cmp", cmp, where, :str)
|
|
47
|
+
Wire.put(w, "val", val, where, :str)
|
|
48
|
+
Wire.put(w, "vals", vals, where, :str, :list)
|
|
49
|
+
Wire.put(w, "nodes", nodes, where, FilterNode, :list)
|
|
50
|
+
w
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# The message from the Hash JSON.parse gives for it.
|
|
54
|
+
#
|
|
55
|
+
# @api private
|
|
56
|
+
def self.from_wire(v, where = "FilterNode")
|
|
57
|
+
d = Wire.obj(v, where)
|
|
58
|
+
new(
|
|
59
|
+
op: Wire.get(d, "op", where, :str),
|
|
60
|
+
key: Wire.get(d, "key", where, :str),
|
|
61
|
+
cmp: Wire.get(d, "cmp", where, :str),
|
|
62
|
+
val: Wire.get(d, "val", where, :str),
|
|
63
|
+
vals: Wire.get(d, "vals", where, :str, :list),
|
|
64
|
+
nodes: Wire.get(d, "nodes", where, FilterNode, :list)
|
|
65
|
+
)
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# ConnectRequest is sent when a client connects.
|
|
70
|
+
#
|
|
71
|
+
# @!attribute [r] client
|
|
72
|
+
# @return [String] The unique ID Centrifugo gave the connection.
|
|
73
|
+
# @!attribute [r] transport
|
|
74
|
+
# @return [String] The connection's transport: "websocket", "sse", "uni_sse" and
|
|
75
|
+
# the like.
|
|
76
|
+
# @!attribute [r] protocol
|
|
77
|
+
# @return [String] The client protocol. One of: json, protobuf.
|
|
78
|
+
# @!attribute [r] encoding
|
|
79
|
+
# @return [String] Binary when the proxy has binary_encoding enabled, so that
|
|
80
|
+
# payloads come in the b64 fields, and json otherwise.
|
|
81
|
+
# One of: json, binary.
|
|
82
|
+
# @!attribute [r] data
|
|
83
|
+
# @return [Object, nil] The custom data the client sent with its connect command, if any.
|
|
84
|
+
# @!attribute [r] b64data
|
|
85
|
+
# @return [String] Data in base64, sent instead of data in binary encoding mode.
|
|
86
|
+
# @!attribute [r] name
|
|
87
|
+
# @return [String] The client's name, if it sent one.
|
|
88
|
+
# @!attribute [r] version
|
|
89
|
+
# @return [String] The client's version, if it sent one.
|
|
90
|
+
# @!attribute [r] channels
|
|
91
|
+
# @return [Array<String>] The server-side channels the client asks to be subscribed
|
|
92
|
+
# to. The backend checks its permissions and returns the allowed ones in
|
|
93
|
+
# ConnectResult.channels or ConnectResult.subs.
|
|
94
|
+
class ConnectRequest < Data.define(:client, :transport, :protocol, :encoding, :data, :b64data, :name, :version, :channels)
|
|
95
|
+
include Message
|
|
96
|
+
|
|
97
|
+
def initialize(
|
|
98
|
+
client: "",
|
|
99
|
+
transport: "",
|
|
100
|
+
protocol: "",
|
|
101
|
+
encoding: "",
|
|
102
|
+
data: nil,
|
|
103
|
+
b64data: "",
|
|
104
|
+
name: "",
|
|
105
|
+
version: "",
|
|
106
|
+
channels: []
|
|
107
|
+
)
|
|
108
|
+
super
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# The message as Centrifugo reads it, fields at their zero value left out.
|
|
112
|
+
#
|
|
113
|
+
# @api private
|
|
114
|
+
def to_wire(where = "")
|
|
115
|
+
w = {}
|
|
116
|
+
Wire.put(w, "client", client, where, :str)
|
|
117
|
+
Wire.put(w, "transport", transport, where, :str)
|
|
118
|
+
Wire.put(w, "protocol", protocol, where, :str)
|
|
119
|
+
Wire.put(w, "encoding", encoding, where, :str)
|
|
120
|
+
Wire.put(w, "data", data, where, :json)
|
|
121
|
+
Wire.put(w, "b64data", b64data, where, :str)
|
|
122
|
+
Wire.put(w, "name", name, where, :str)
|
|
123
|
+
Wire.put(w, "version", version, where, :str)
|
|
124
|
+
Wire.put(w, "channels", channels, where, :str, :list)
|
|
125
|
+
w
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# The message from the Hash JSON.parse gives for it.
|
|
129
|
+
#
|
|
130
|
+
# @api private
|
|
131
|
+
def self.from_wire(v, where = "ConnectRequest")
|
|
132
|
+
d = Wire.obj(v, where)
|
|
133
|
+
new(
|
|
134
|
+
client: Wire.get(d, "client", where, :str),
|
|
135
|
+
transport: Wire.get(d, "transport", where, :str),
|
|
136
|
+
protocol: Wire.get(d, "protocol", where, :str),
|
|
137
|
+
encoding: Wire.get(d, "encoding", where, :str),
|
|
138
|
+
data: Wire.get(d, "data", where, :json),
|
|
139
|
+
b64data: Wire.get(d, "b64data", where, :str),
|
|
140
|
+
name: Wire.get(d, "name", where, :str),
|
|
141
|
+
version: Wire.get(d, "version", where, :str),
|
|
142
|
+
channels: Wire.get(d, "channels", where, :str, :list)
|
|
143
|
+
)
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# SubscribeOptions are the options of a server-side subscription returned in
|
|
148
|
+
# ConnectResult.subs.
|
|
149
|
+
#
|
|
150
|
+
# @!attribute [r] expire_at
|
|
151
|
+
# @return [Integer] When the subscription expires, in Unix seconds. Zero means it
|
|
152
|
+
# does not expire.
|
|
153
|
+
# @!attribute [r] info
|
|
154
|
+
# @return [Object, nil] Channel-specific information about the connection, as JSON: it is
|
|
155
|
+
# part of presence data, join and leave events and the client's
|
|
156
|
+
# publications in the channel.
|
|
157
|
+
# @!attribute [r] b64info
|
|
158
|
+
# @return [String] Info in base64, for binary info.
|
|
159
|
+
# @!attribute [r] data
|
|
160
|
+
# @return [Object, nil] Custom data sent to the client with the subscription in the
|
|
161
|
+
# connect reply.
|
|
162
|
+
# @!attribute [r] b64data
|
|
163
|
+
# @return [String] Data in base64, for binary data.
|
|
164
|
+
# @!attribute [r] override
|
|
165
|
+
# @return [SubscribeOptionOverride, nil] Overrides channel options of the namespace for this
|
|
166
|
+
# subscription.
|
|
167
|
+
# @!attribute [r] server_tags_filter
|
|
168
|
+
# @return [FilterNode, nil] Makes the subscription receive only publications
|
|
169
|
+
# whose tags match it. Centrifugo PRO only.
|
|
170
|
+
# @!attribute [r] cache_recover
|
|
171
|
+
# @return [Boolean] When set, makes Centrifugo initiate cache recovery for the
|
|
172
|
+
# server-side subscription without requiring the client to provide a recover
|
|
173
|
+
# flag/position itself. This is the server-side equivalent of subscribing with an
|
|
174
|
+
# empty `since` on the client. Mostly useful for unidirectional clients which do
|
|
175
|
+
# not know channel names. Requires recovery to be enabled for the channel and only
|
|
176
|
+
# applies in cache recovery mode, where it delivers the latest publication on
|
|
177
|
+
# (re)subscribe.
|
|
178
|
+
class SubscribeOptions < Data.define(:expire_at, :info, :b64info, :data, :b64data, :override, :server_tags_filter, :cache_recover)
|
|
179
|
+
include Message
|
|
180
|
+
|
|
181
|
+
def initialize(
|
|
182
|
+
expire_at: 0,
|
|
183
|
+
info: nil,
|
|
184
|
+
b64info: "",
|
|
185
|
+
data: nil,
|
|
186
|
+
b64data: "",
|
|
187
|
+
override: nil,
|
|
188
|
+
server_tags_filter: nil,
|
|
189
|
+
cache_recover: false
|
|
190
|
+
)
|
|
191
|
+
super
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# The message as Centrifugo reads it, fields at their zero value left out.
|
|
195
|
+
#
|
|
196
|
+
# @api private
|
|
197
|
+
def to_wire(where = "")
|
|
198
|
+
w = {}
|
|
199
|
+
Wire.put(w, "expire_at", expire_at, where, :int)
|
|
200
|
+
Wire.put(w, "info", info, where, :json)
|
|
201
|
+
Wire.put(w, "b64info", b64info, where, :str)
|
|
202
|
+
Wire.put(w, "data", data, where, :json)
|
|
203
|
+
Wire.put(w, "b64data", b64data, where, :str)
|
|
204
|
+
Wire.put(w, "override", override, where, SubscribeOptionOverride)
|
|
205
|
+
Wire.put(w, "server_tags_filter", server_tags_filter, where, FilterNode)
|
|
206
|
+
Wire.put(w, "cache_recover", cache_recover, where, :bool)
|
|
207
|
+
w
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
# The message from the Hash JSON.parse gives for it.
|
|
211
|
+
#
|
|
212
|
+
# @api private
|
|
213
|
+
def self.from_wire(v, where = "SubscribeOptions")
|
|
214
|
+
d = Wire.obj(v, where)
|
|
215
|
+
new(
|
|
216
|
+
expire_at: Wire.get(d, "expire_at", where, :int),
|
|
217
|
+
info: Wire.get(d, "info", where, :json),
|
|
218
|
+
b64info: Wire.get(d, "b64info", where, :str),
|
|
219
|
+
data: Wire.get(d, "data", where, :json),
|
|
220
|
+
b64data: Wire.get(d, "b64data", where, :str),
|
|
221
|
+
override: Wire.get(d, "override", where, SubscribeOptionOverride),
|
|
222
|
+
server_tags_filter: Wire.get(d, "server_tags_filter", where, FilterNode),
|
|
223
|
+
cache_recover: Wire.get(d, "cache_recover", where, :bool)
|
|
224
|
+
)
|
|
225
|
+
end
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
# ConnectResult accepts the connection.
|
|
229
|
+
#
|
|
230
|
+
# @!attribute [r] user
|
|
231
|
+
# @return [String] The ID of the user the connection belongs to. Empty accepts an
|
|
232
|
+
# anonymous connection.
|
|
233
|
+
# @!attribute [r] expire_at
|
|
234
|
+
# @return [Integer] When the connection expires, in Unix seconds, unless
|
|
235
|
+
# refreshed - by the refresh proxy, when one is configured. Zero means it
|
|
236
|
+
# does not expire.
|
|
237
|
+
# @!attribute [r] info
|
|
238
|
+
# @return [Object, nil] Information about the connection, as JSON: it is part of presence
|
|
239
|
+
# data, join and leave events and the client's publications.
|
|
240
|
+
# @!attribute [r] b64info
|
|
241
|
+
# @return [String] Info in base64, for binary info.
|
|
242
|
+
# @!attribute [r] data
|
|
243
|
+
# @return [Object, nil] Custom data sent to the client in the connect reply.
|
|
244
|
+
# @!attribute [r] b64data
|
|
245
|
+
# @return [String] Data in base64, for binary data.
|
|
246
|
+
# @!attribute [r] channels
|
|
247
|
+
# @return [Array<String>] Server-side channels to subscribe the connection to.
|
|
248
|
+
# @!attribute [r] subs
|
|
249
|
+
# @return [Hash{String => SubscribeOptions}] Server-side channels to subscribe the connection to, each with
|
|
250
|
+
# its options.
|
|
251
|
+
# @!attribute [r] meta
|
|
252
|
+
# @return [Object, nil] Custom data attached to the connection, as JSON. It is never sent
|
|
253
|
+
# to the client; proxies with include_connection_meta receive it.
|
|
254
|
+
# @!attribute [r] caps
|
|
255
|
+
# @return [Array<ChannelsCapability>] Capabilities granting the connection operations in channels.
|
|
256
|
+
# Centrifugo PRO only.
|
|
257
|
+
# @!attribute [r] labels
|
|
258
|
+
# @return [Hash{String => String}] PRO only — client labels attached to the centrifuge.Client by Centrifugo PRO.
|
|
259
|
+
# Parsed by OSS but not used (OSS does not populate centrifuge.ConnectReply.Labels).
|
|
260
|
+
# @!attribute [r] profile
|
|
261
|
+
# @return [String] Assigns the connection to a dictionary compression profile, as the
|
|
262
|
+
# profile claim of a connection token does: it overrides the profile the
|
|
263
|
+
# client declared. Centrifugo PRO only.
|
|
264
|
+
class ConnectResult < Data.define(:user, :expire_at, :info, :b64info, :data, :b64data, :channels, :subs, :meta, :caps, :labels, :profile)
|
|
265
|
+
include Message
|
|
266
|
+
|
|
267
|
+
def initialize(
|
|
268
|
+
user: "",
|
|
269
|
+
expire_at: 0,
|
|
270
|
+
info: nil,
|
|
271
|
+
b64info: "",
|
|
272
|
+
data: nil,
|
|
273
|
+
b64data: "",
|
|
274
|
+
channels: [],
|
|
275
|
+
subs: {},
|
|
276
|
+
meta: nil,
|
|
277
|
+
caps: [],
|
|
278
|
+
labels: {},
|
|
279
|
+
profile: ""
|
|
280
|
+
)
|
|
281
|
+
super
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
# The message as Centrifugo reads it, fields at their zero value left out.
|
|
285
|
+
#
|
|
286
|
+
# @api private
|
|
287
|
+
def to_wire(where = "")
|
|
288
|
+
w = {}
|
|
289
|
+
Wire.put(w, "user", user, where, :str)
|
|
290
|
+
Wire.put(w, "expire_at", expire_at, where, :int)
|
|
291
|
+
Wire.put(w, "info", info, where, :json)
|
|
292
|
+
Wire.put(w, "b64info", b64info, where, :str)
|
|
293
|
+
Wire.put(w, "data", data, where, :json)
|
|
294
|
+
Wire.put(w, "b64data", b64data, where, :str)
|
|
295
|
+
Wire.put(w, "channels", channels, where, :str, :list)
|
|
296
|
+
Wire.put(w, "subs", subs, where, SubscribeOptions, :map)
|
|
297
|
+
Wire.put(w, "meta", meta, where, :json)
|
|
298
|
+
Wire.put(w, "caps", caps, where, ChannelsCapability, :list)
|
|
299
|
+
Wire.put(w, "labels", labels, where, :str, :map)
|
|
300
|
+
Wire.put(w, "profile", profile, where, :str)
|
|
301
|
+
w
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
# The message from the Hash JSON.parse gives for it.
|
|
305
|
+
#
|
|
306
|
+
# @api private
|
|
307
|
+
def self.from_wire(v, where = "ConnectResult")
|
|
308
|
+
d = Wire.obj(v, where)
|
|
309
|
+
new(
|
|
310
|
+
user: Wire.get(d, "user", where, :str),
|
|
311
|
+
expire_at: Wire.get(d, "expire_at", where, :int),
|
|
312
|
+
info: Wire.get(d, "info", where, :json),
|
|
313
|
+
b64info: Wire.get(d, "b64info", where, :str),
|
|
314
|
+
data: Wire.get(d, "data", where, :json),
|
|
315
|
+
b64data: Wire.get(d, "b64data", where, :str),
|
|
316
|
+
channels: Wire.get(d, "channels", where, :str, :list),
|
|
317
|
+
subs: Wire.get(d, "subs", where, SubscribeOptions, :map),
|
|
318
|
+
meta: Wire.get(d, "meta", where, :json),
|
|
319
|
+
caps: Wire.get(d, "caps", where, ChannelsCapability, :list),
|
|
320
|
+
labels: Wire.get(d, "labels", where, :str, :map),
|
|
321
|
+
profile: Wire.get(d, "profile", where, :str)
|
|
322
|
+
)
|
|
323
|
+
end
|
|
324
|
+
end
|
|
325
|
+
|
|
326
|
+
# ChannelsCapability grants operations in channels. A connection may do an
|
|
327
|
+
# operation in a channel when any of its capabilities both allows the
|
|
328
|
+
# operation and matches the channel. Centrifugo PRO only.
|
|
329
|
+
#
|
|
330
|
+
# @!attribute [r] channels
|
|
331
|
+
# @return [Array<String>] The channels, or channel patterns, it applies to.
|
|
332
|
+
# @!attribute [r] allow
|
|
333
|
+
# @return [Array<String>] The operations it grants: sub is subscribe, pub publish, hst
|
|
334
|
+
# history, prs presence. One of: sub, pub, hst, prs.
|
|
335
|
+
# @!attribute [r] match
|
|
336
|
+
# @return [String] How channels are matched: empty for exact names. One of:
|
|
337
|
+
# wildcard, regex.
|
|
338
|
+
class ChannelsCapability < Data.define(:channels, :allow, :match)
|
|
339
|
+
include Message
|
|
340
|
+
|
|
341
|
+
def initialize(channels: [], allow: [], match: "") = super
|
|
342
|
+
|
|
343
|
+
# The message as Centrifugo reads it, fields at their zero value left out.
|
|
344
|
+
#
|
|
345
|
+
# @api private
|
|
346
|
+
def to_wire(where = "")
|
|
347
|
+
w = {}
|
|
348
|
+
Wire.put(w, "channels", channels, where, :str, :list)
|
|
349
|
+
Wire.put(w, "allow", allow, where, :str, :list)
|
|
350
|
+
Wire.put(w, "match", match, where, :str)
|
|
351
|
+
w
|
|
352
|
+
end
|
|
353
|
+
|
|
354
|
+
# The message from the Hash JSON.parse gives for it.
|
|
355
|
+
#
|
|
356
|
+
# @api private
|
|
357
|
+
def self.from_wire(v, where = "ChannelsCapability")
|
|
358
|
+
d = Wire.obj(v, where)
|
|
359
|
+
new(
|
|
360
|
+
channels: Wire.get(d, "channels", where, :str, :list),
|
|
361
|
+
allow: Wire.get(d, "allow", where, :str, :list),
|
|
362
|
+
match: Wire.get(d, "match", where, :str)
|
|
363
|
+
)
|
|
364
|
+
end
|
|
365
|
+
end
|
|
366
|
+
|
|
367
|
+
# RefreshRequest is sent when a connection is about to expire.
|
|
368
|
+
#
|
|
369
|
+
# @!attribute [r] client
|
|
370
|
+
# @return [String] The unique ID Centrifugo gave the connection.
|
|
371
|
+
# @!attribute [r] transport
|
|
372
|
+
# @return [String] The connection's transport.
|
|
373
|
+
# @!attribute [r] protocol
|
|
374
|
+
# @return [String] The client protocol. One of: json, protobuf.
|
|
375
|
+
# @!attribute [r] encoding
|
|
376
|
+
# @return [String] Binary when the proxy has binary_encoding enabled, so that
|
|
377
|
+
# payloads come in the b64 fields, and json otherwise.
|
|
378
|
+
# One of: json, binary.
|
|
379
|
+
# @!attribute [r] user
|
|
380
|
+
# @return [String] The connection's user ID.
|
|
381
|
+
# @!attribute [r] meta
|
|
382
|
+
# @return [Object, nil] The connection's meta, when the proxy has include_connection_meta.
|
|
383
|
+
# @!attribute [r] labels
|
|
384
|
+
# @return [Hash{String => String}] PRO only — connection labels attached to the originating centrifuge.Client.
|
|
385
|
+
# Centrifugo PRO always populates this from Client.Labels() (no opt-in toggle).
|
|
386
|
+
class RefreshRequest < Data.define(:client, :transport, :protocol, :encoding, :user, :meta, :labels)
|
|
387
|
+
include Message
|
|
388
|
+
|
|
389
|
+
def initialize(
|
|
390
|
+
client: "",
|
|
391
|
+
transport: "",
|
|
392
|
+
protocol: "",
|
|
393
|
+
encoding: "",
|
|
394
|
+
user: "",
|
|
395
|
+
meta: nil,
|
|
396
|
+
labels: {}
|
|
397
|
+
)
|
|
398
|
+
super
|
|
399
|
+
end
|
|
400
|
+
|
|
401
|
+
# The message as Centrifugo reads it, fields at their zero value left out.
|
|
402
|
+
#
|
|
403
|
+
# @api private
|
|
404
|
+
def to_wire(where = "")
|
|
405
|
+
w = {}
|
|
406
|
+
Wire.put(w, "client", client, where, :str)
|
|
407
|
+
Wire.put(w, "transport", transport, where, :str)
|
|
408
|
+
Wire.put(w, "protocol", protocol, where, :str)
|
|
409
|
+
Wire.put(w, "encoding", encoding, where, :str)
|
|
410
|
+
Wire.put(w, "user", user, where, :str)
|
|
411
|
+
Wire.put(w, "meta", meta, where, :json)
|
|
412
|
+
Wire.put(w, "labels", labels, where, :str, :map)
|
|
413
|
+
w
|
|
414
|
+
end
|
|
415
|
+
|
|
416
|
+
# The message from the Hash JSON.parse gives for it.
|
|
417
|
+
#
|
|
418
|
+
# @api private
|
|
419
|
+
def self.from_wire(v, where = "RefreshRequest")
|
|
420
|
+
d = Wire.obj(v, where)
|
|
421
|
+
new(
|
|
422
|
+
client: Wire.get(d, "client", where, :str),
|
|
423
|
+
transport: Wire.get(d, "transport", where, :str),
|
|
424
|
+
protocol: Wire.get(d, "protocol", where, :str),
|
|
425
|
+
encoding: Wire.get(d, "encoding", where, :str),
|
|
426
|
+
user: Wire.get(d, "user", where, :str),
|
|
427
|
+
meta: Wire.get(d, "meta", where, :json),
|
|
428
|
+
labels: Wire.get(d, "labels", where, :str, :map)
|
|
429
|
+
)
|
|
430
|
+
end
|
|
431
|
+
end
|
|
432
|
+
|
|
433
|
+
# RefreshResult extends the connection, or ends it.
|
|
434
|
+
#
|
|
435
|
+
# @!attribute [r] expired
|
|
436
|
+
# @return [Boolean] Disconnects the client: its connection has expired.
|
|
437
|
+
# @!attribute [r] expire_at
|
|
438
|
+
# @return [Integer] When the connection expires next, in Unix seconds.
|
|
439
|
+
# @!attribute [r] info
|
|
440
|
+
# @return [Object, nil] Replaces the connection's info, as JSON.
|
|
441
|
+
# @!attribute [r] b64info
|
|
442
|
+
# @return [String] Info in base64, for binary info.
|
|
443
|
+
# @!attribute [r] meta
|
|
444
|
+
# @return [Object, nil] Replaces the connection's meta, as JSON.
|
|
445
|
+
# @!attribute [r] caps
|
|
446
|
+
# @return [Array<ChannelsCapability>] Replace the connection's capabilities. Centrifugo PRO only.
|
|
447
|
+
class RefreshResult < Data.define(:expired, :expire_at, :info, :b64info, :meta, :caps)
|
|
448
|
+
include Message
|
|
449
|
+
|
|
450
|
+
def initialize(
|
|
451
|
+
expired: false,
|
|
452
|
+
expire_at: 0,
|
|
453
|
+
info: nil,
|
|
454
|
+
b64info: "",
|
|
455
|
+
meta: nil,
|
|
456
|
+
caps: []
|
|
457
|
+
)
|
|
458
|
+
super
|
|
459
|
+
end
|
|
460
|
+
|
|
461
|
+
# The message as Centrifugo reads it, fields at their zero value left out.
|
|
462
|
+
#
|
|
463
|
+
# @api private
|
|
464
|
+
def to_wire(where = "")
|
|
465
|
+
w = {}
|
|
466
|
+
Wire.put(w, "expired", expired, where, :bool)
|
|
467
|
+
Wire.put(w, "expire_at", expire_at, where, :int)
|
|
468
|
+
Wire.put(w, "info", info, where, :json)
|
|
469
|
+
Wire.put(w, "b64info", b64info, where, :str)
|
|
470
|
+
Wire.put(w, "meta", meta, where, :json)
|
|
471
|
+
Wire.put(w, "caps", caps, where, ChannelsCapability, :list)
|
|
472
|
+
w
|
|
473
|
+
end
|
|
474
|
+
|
|
475
|
+
# The message from the Hash JSON.parse gives for it.
|
|
476
|
+
#
|
|
477
|
+
# @api private
|
|
478
|
+
def self.from_wire(v, where = "RefreshResult")
|
|
479
|
+
d = Wire.obj(v, where)
|
|
480
|
+
new(
|
|
481
|
+
expired: Wire.get(d, "expired", where, :bool),
|
|
482
|
+
expire_at: Wire.get(d, "expire_at", where, :int),
|
|
483
|
+
info: Wire.get(d, "info", where, :json),
|
|
484
|
+
b64info: Wire.get(d, "b64info", where, :str),
|
|
485
|
+
meta: Wire.get(d, "meta", where, :json),
|
|
486
|
+
caps: Wire.get(d, "caps", where, ChannelsCapability, :list)
|
|
487
|
+
)
|
|
488
|
+
end
|
|
489
|
+
end
|
|
490
|
+
|
|
491
|
+
# SubscribeRequest is sent when a client subscribes to a channel.
|
|
492
|
+
#
|
|
493
|
+
# @!attribute [r] client
|
|
494
|
+
# @return [String] The unique ID Centrifugo gave the connection.
|
|
495
|
+
# @!attribute [r] transport
|
|
496
|
+
# @return [String] The connection's transport.
|
|
497
|
+
# @!attribute [r] protocol
|
|
498
|
+
# @return [String] The client protocol. One of: json, protobuf.
|
|
499
|
+
# @!attribute [r] encoding
|
|
500
|
+
# @return [String] Binary when the proxy has binary_encoding enabled, so that
|
|
501
|
+
# payloads come in the b64 fields, and json otherwise.
|
|
502
|
+
# One of: json, binary.
|
|
503
|
+
# @!attribute [r] user
|
|
504
|
+
# @return [String] The connection's user ID.
|
|
505
|
+
# @!attribute [r] channel
|
|
506
|
+
# @return [String] The channel the client subscribes to.
|
|
507
|
+
# @!attribute [r] token
|
|
508
|
+
# @return [String] The subscription token the client sent for the channel, if any.
|
|
509
|
+
# @!attribute [r] meta
|
|
510
|
+
# @return [Object, nil] The connection's meta, when the proxy has include_connection_meta.
|
|
511
|
+
# @!attribute [r] data
|
|
512
|
+
# @return [Object, nil] The custom data the client sent with its subscribe command, if any.
|
|
513
|
+
# @!attribute [r] b64data
|
|
514
|
+
# @return [String] Data in base64, sent instead of data in binary encoding mode.
|
|
515
|
+
# @!attribute [r] labels
|
|
516
|
+
# @return [Hash{String => String}] PRO only — connection labels attached to the originating centrifuge.Client.
|
|
517
|
+
# Centrifugo PRO always populates this from Client.Labels() (no opt-in toggle).
|
|
518
|
+
class SubscribeRequest < Data.define(:client, :transport, :protocol, :encoding, :user, :channel, :token, :meta, :data, :b64data, :labels)
|
|
519
|
+
include Message
|
|
520
|
+
|
|
521
|
+
def initialize(
|
|
522
|
+
client: "",
|
|
523
|
+
transport: "",
|
|
524
|
+
protocol: "",
|
|
525
|
+
encoding: "",
|
|
526
|
+
user: "",
|
|
527
|
+
channel: "",
|
|
528
|
+
token: "",
|
|
529
|
+
meta: nil,
|
|
530
|
+
data: nil,
|
|
531
|
+
b64data: "",
|
|
532
|
+
labels: {}
|
|
533
|
+
)
|
|
534
|
+
super
|
|
535
|
+
end
|
|
536
|
+
|
|
537
|
+
# The message as Centrifugo reads it, fields at their zero value left out.
|
|
538
|
+
#
|
|
539
|
+
# @api private
|
|
540
|
+
def to_wire(where = "")
|
|
541
|
+
w = {}
|
|
542
|
+
Wire.put(w, "client", client, where, :str)
|
|
543
|
+
Wire.put(w, "transport", transport, where, :str)
|
|
544
|
+
Wire.put(w, "protocol", protocol, where, :str)
|
|
545
|
+
Wire.put(w, "encoding", encoding, where, :str)
|
|
546
|
+
Wire.put(w, "user", user, where, :str)
|
|
547
|
+
Wire.put(w, "channel", channel, where, :str)
|
|
548
|
+
Wire.put(w, "token", token, where, :str)
|
|
549
|
+
Wire.put(w, "meta", meta, where, :json)
|
|
550
|
+
Wire.put(w, "data", data, where, :json)
|
|
551
|
+
Wire.put(w, "b64data", b64data, where, :str)
|
|
552
|
+
Wire.put(w, "labels", labels, where, :str, :map)
|
|
553
|
+
w
|
|
554
|
+
end
|
|
555
|
+
|
|
556
|
+
# The message from the Hash JSON.parse gives for it.
|
|
557
|
+
#
|
|
558
|
+
# @api private
|
|
559
|
+
def self.from_wire(v, where = "SubscribeRequest")
|
|
560
|
+
d = Wire.obj(v, where)
|
|
561
|
+
new(
|
|
562
|
+
client: Wire.get(d, "client", where, :str),
|
|
563
|
+
transport: Wire.get(d, "transport", where, :str),
|
|
564
|
+
protocol: Wire.get(d, "protocol", where, :str),
|
|
565
|
+
encoding: Wire.get(d, "encoding", where, :str),
|
|
566
|
+
user: Wire.get(d, "user", where, :str),
|
|
567
|
+
channel: Wire.get(d, "channel", where, :str),
|
|
568
|
+
token: Wire.get(d, "token", where, :str),
|
|
569
|
+
meta: Wire.get(d, "meta", where, :json),
|
|
570
|
+
data: Wire.get(d, "data", where, :json),
|
|
571
|
+
b64data: Wire.get(d, "b64data", where, :str),
|
|
572
|
+
labels: Wire.get(d, "labels", where, :str, :map)
|
|
573
|
+
)
|
|
574
|
+
end
|
|
575
|
+
end
|
|
576
|
+
|
|
577
|
+
# SubscribeOptionOverride overrides channel options of the namespace for one
|
|
578
|
+
# subscription. An unset field keeps the namespace's value.
|
|
579
|
+
#
|
|
580
|
+
# @!attribute [r] presence
|
|
581
|
+
# @return [Boolean, nil] Overrides the namespace's presence option.
|
|
582
|
+
# @!attribute [r] join_leave
|
|
583
|
+
# @return [Boolean, nil] Overrides the namespace's join_leave option.
|
|
584
|
+
# @!attribute [r] force_recovery
|
|
585
|
+
# @return [Boolean, nil] Overrides the namespace's force_recovery option.
|
|
586
|
+
# @!attribute [r] force_positioning
|
|
587
|
+
# @return [Boolean, nil] Overrides the namespace's force_positioning option.
|
|
588
|
+
# @!attribute [r] force_push_join_leave
|
|
589
|
+
# @return [Boolean, nil] Overrides the namespace's force_push_join_leave
|
|
590
|
+
# option.
|
|
591
|
+
class SubscribeOptionOverride < Data.define(:presence, :join_leave, :force_recovery, :force_positioning, :force_push_join_leave)
|
|
592
|
+
include Message
|
|
593
|
+
|
|
594
|
+
def initialize(
|
|
595
|
+
presence: nil,
|
|
596
|
+
join_leave: nil,
|
|
597
|
+
force_recovery: nil,
|
|
598
|
+
force_positioning: nil,
|
|
599
|
+
force_push_join_leave: nil
|
|
600
|
+
)
|
|
601
|
+
super
|
|
602
|
+
end
|
|
603
|
+
|
|
604
|
+
# The message as Centrifugo reads it, fields at their zero value left out.
|
|
605
|
+
#
|
|
606
|
+
# @api private
|
|
607
|
+
def to_wire(where = "")
|
|
608
|
+
w = {}
|
|
609
|
+
Wire.put(w, "presence", presence, where, :bool_value)
|
|
610
|
+
Wire.put(w, "join_leave", join_leave, where, :bool_value)
|
|
611
|
+
Wire.put(w, "force_recovery", force_recovery, where, :bool_value)
|
|
612
|
+
Wire.put(w, "force_positioning", force_positioning, where, :bool_value)
|
|
613
|
+
Wire.put(w, "force_push_join_leave", force_push_join_leave, where, :bool_value)
|
|
614
|
+
w
|
|
615
|
+
end
|
|
616
|
+
|
|
617
|
+
# The message from the Hash JSON.parse gives for it.
|
|
618
|
+
#
|
|
619
|
+
# @api private
|
|
620
|
+
def self.from_wire(v, where = "SubscribeOptionOverride")
|
|
621
|
+
d = Wire.obj(v, where)
|
|
622
|
+
new(
|
|
623
|
+
presence: Wire.get(d, "presence", where, :bool_value),
|
|
624
|
+
join_leave: Wire.get(d, "join_leave", where, :bool_value),
|
|
625
|
+
force_recovery: Wire.get(d, "force_recovery", where, :bool_value),
|
|
626
|
+
force_positioning: Wire.get(d, "force_positioning", where, :bool_value),
|
|
627
|
+
force_push_join_leave: Wire.get(d, "force_push_join_leave", where, :bool_value)
|
|
628
|
+
)
|
|
629
|
+
end
|
|
630
|
+
end
|
|
631
|
+
|
|
632
|
+
# SubscribeResult accepts the subscription.
|
|
633
|
+
#
|
|
634
|
+
# @!attribute [r] expire_at
|
|
635
|
+
# @return [Integer] When the subscription expires, in Unix seconds, unless
|
|
636
|
+
# refreshed - by the sub refresh proxy, when one is configured. Zero means
|
|
637
|
+
# it does not expire.
|
|
638
|
+
# @!attribute [r] info
|
|
639
|
+
# @return [Object, nil] Channel-specific information about the connection, as JSON: it is
|
|
640
|
+
# part of presence data, join and leave events and the client's
|
|
641
|
+
# publications in the channel.
|
|
642
|
+
# @!attribute [r] b64info
|
|
643
|
+
# @return [String] Info in base64, for binary info.
|
|
644
|
+
# @!attribute [r] data
|
|
645
|
+
# @return [Object, nil] Custom data sent to the client in the subscribe reply.
|
|
646
|
+
# @!attribute [r] b64data
|
|
647
|
+
# @return [String] Data in base64, for binary data.
|
|
648
|
+
# @!attribute [r] override
|
|
649
|
+
# @return [SubscribeOptionOverride, nil] Overrides channel options of the namespace for this
|
|
650
|
+
# subscription.
|
|
651
|
+
# @!attribute [r] allow
|
|
652
|
+
# @return [Array<String>] Capabilities granted in the channel for this subscription.
|
|
653
|
+
# Centrifugo PRO only. One of: sub, pub, hst, prs.
|
|
654
|
+
# @!attribute [r] server_tags_filter
|
|
655
|
+
# @return [FilterNode, nil] Makes the subscription receive only publications
|
|
656
|
+
# whose tags match it. Centrifugo PRO only.
|
|
657
|
+
class SubscribeResult < Data.define(:expire_at, :info, :b64info, :data, :b64data, :override, :allow, :server_tags_filter)
|
|
658
|
+
include Message
|
|
659
|
+
|
|
660
|
+
def initialize(
|
|
661
|
+
expire_at: 0,
|
|
662
|
+
info: nil,
|
|
663
|
+
b64info: "",
|
|
664
|
+
data: nil,
|
|
665
|
+
b64data: "",
|
|
666
|
+
override: nil,
|
|
667
|
+
allow: [],
|
|
668
|
+
server_tags_filter: nil
|
|
669
|
+
)
|
|
670
|
+
super
|
|
671
|
+
end
|
|
672
|
+
|
|
673
|
+
# The message as Centrifugo reads it, fields at their zero value left out.
|
|
674
|
+
#
|
|
675
|
+
# @api private
|
|
676
|
+
def to_wire(where = "")
|
|
677
|
+
w = {}
|
|
678
|
+
Wire.put(w, "expire_at", expire_at, where, :int)
|
|
679
|
+
Wire.put(w, "info", info, where, :json)
|
|
680
|
+
Wire.put(w, "b64info", b64info, where, :str)
|
|
681
|
+
Wire.put(w, "data", data, where, :json)
|
|
682
|
+
Wire.put(w, "b64data", b64data, where, :str)
|
|
683
|
+
Wire.put(w, "override", override, where, SubscribeOptionOverride)
|
|
684
|
+
Wire.put(w, "allow", allow, where, :str, :list)
|
|
685
|
+
Wire.put(w, "server_tags_filter", server_tags_filter, where, FilterNode)
|
|
686
|
+
w
|
|
687
|
+
end
|
|
688
|
+
|
|
689
|
+
# The message from the Hash JSON.parse gives for it.
|
|
690
|
+
#
|
|
691
|
+
# @api private
|
|
692
|
+
def self.from_wire(v, where = "SubscribeResult")
|
|
693
|
+
d = Wire.obj(v, where)
|
|
694
|
+
new(
|
|
695
|
+
expire_at: Wire.get(d, "expire_at", where, :int),
|
|
696
|
+
info: Wire.get(d, "info", where, :json),
|
|
697
|
+
b64info: Wire.get(d, "b64info", where, :str),
|
|
698
|
+
data: Wire.get(d, "data", where, :json),
|
|
699
|
+
b64data: Wire.get(d, "b64data", where, :str),
|
|
700
|
+
override: Wire.get(d, "override", where, SubscribeOptionOverride),
|
|
701
|
+
allow: Wire.get(d, "allow", where, :str, :list),
|
|
702
|
+
server_tags_filter: Wire.get(d, "server_tags_filter", where, FilterNode)
|
|
703
|
+
)
|
|
704
|
+
end
|
|
705
|
+
end
|
|
706
|
+
|
|
707
|
+
# PublishRequest is sent when a client publishes into a channel.
|
|
708
|
+
#
|
|
709
|
+
# @!attribute [r] client
|
|
710
|
+
# @return [String] The unique ID Centrifugo gave the connection.
|
|
711
|
+
# @!attribute [r] transport
|
|
712
|
+
# @return [String] The connection's transport.
|
|
713
|
+
# @!attribute [r] protocol
|
|
714
|
+
# @return [String] The client protocol. One of: json, protobuf.
|
|
715
|
+
# @!attribute [r] encoding
|
|
716
|
+
# @return [String] Binary when the proxy has binary_encoding enabled, so that
|
|
717
|
+
# payloads come in the b64 fields, and json otherwise.
|
|
718
|
+
# One of: json, binary.
|
|
719
|
+
# @!attribute [r] user
|
|
720
|
+
# @return [String] The connection's user ID.
|
|
721
|
+
# @!attribute [r] channel
|
|
722
|
+
# @return [String] The channel the client publishes into.
|
|
723
|
+
# @!attribute [r] data
|
|
724
|
+
# @return [Object, nil] The data the client publishes.
|
|
725
|
+
# @!attribute [r] b64data
|
|
726
|
+
# @return [String] Data in base64, sent instead of data in binary encoding mode.
|
|
727
|
+
# @!attribute [r] meta
|
|
728
|
+
# @return [Object, nil] The connection's meta, when the proxy has include_connection_meta.
|
|
729
|
+
# @!attribute [r] labels
|
|
730
|
+
# @return [Hash{String => String}] PRO only — connection labels attached to the originating centrifuge.Client.
|
|
731
|
+
# Centrifugo PRO always populates this from Client.Labels() (no opt-in toggle).
|
|
732
|
+
class PublishRequest < Data.define(:client, :transport, :protocol, :encoding, :user, :channel, :data, :b64data, :meta, :labels)
|
|
733
|
+
include Message
|
|
734
|
+
|
|
735
|
+
def initialize(
|
|
736
|
+
client: "",
|
|
737
|
+
transport: "",
|
|
738
|
+
protocol: "",
|
|
739
|
+
encoding: "",
|
|
740
|
+
user: "",
|
|
741
|
+
channel: "",
|
|
742
|
+
data: nil,
|
|
743
|
+
b64data: "",
|
|
744
|
+
meta: nil,
|
|
745
|
+
labels: {}
|
|
746
|
+
)
|
|
747
|
+
super
|
|
748
|
+
end
|
|
749
|
+
|
|
750
|
+
# The message as Centrifugo reads it, fields at their zero value left out.
|
|
751
|
+
#
|
|
752
|
+
# @api private
|
|
753
|
+
def to_wire(where = "")
|
|
754
|
+
w = {}
|
|
755
|
+
Wire.put(w, "client", client, where, :str)
|
|
756
|
+
Wire.put(w, "transport", transport, where, :str)
|
|
757
|
+
Wire.put(w, "protocol", protocol, where, :str)
|
|
758
|
+
Wire.put(w, "encoding", encoding, where, :str)
|
|
759
|
+
Wire.put(w, "user", user, where, :str)
|
|
760
|
+
Wire.put(w, "channel", channel, where, :str)
|
|
761
|
+
Wire.put(w, "data", data, where, :json)
|
|
762
|
+
Wire.put(w, "b64data", b64data, where, :str)
|
|
763
|
+
Wire.put(w, "meta", meta, where, :json)
|
|
764
|
+
Wire.put(w, "labels", labels, where, :str, :map)
|
|
765
|
+
w
|
|
766
|
+
end
|
|
767
|
+
|
|
768
|
+
# The message from the Hash JSON.parse gives for it.
|
|
769
|
+
#
|
|
770
|
+
# @api private
|
|
771
|
+
def self.from_wire(v, where = "PublishRequest")
|
|
772
|
+
d = Wire.obj(v, where)
|
|
773
|
+
new(
|
|
774
|
+
client: Wire.get(d, "client", where, :str),
|
|
775
|
+
transport: Wire.get(d, "transport", where, :str),
|
|
776
|
+
protocol: Wire.get(d, "protocol", where, :str),
|
|
777
|
+
encoding: Wire.get(d, "encoding", where, :str),
|
|
778
|
+
user: Wire.get(d, "user", where, :str),
|
|
779
|
+
channel: Wire.get(d, "channel", where, :str),
|
|
780
|
+
data: Wire.get(d, "data", where, :json),
|
|
781
|
+
b64data: Wire.get(d, "b64data", where, :str),
|
|
782
|
+
meta: Wire.get(d, "meta", where, :json),
|
|
783
|
+
labels: Wire.get(d, "labels", where, :str, :map)
|
|
784
|
+
)
|
|
785
|
+
end
|
|
786
|
+
end
|
|
787
|
+
|
|
788
|
+
# PublishResult accepts the publication. Fields left unset keep what the
|
|
789
|
+
# client sent, or the defaults.
|
|
790
|
+
#
|
|
791
|
+
# @!attribute [r] data
|
|
792
|
+
# @return [Object, nil] Replaces the data the client sent.
|
|
793
|
+
# @!attribute [r] b64data
|
|
794
|
+
# @return [String] Data in base64, for binary data.
|
|
795
|
+
# @!attribute [r] skip_history
|
|
796
|
+
# @return [Boolean] Publishes without saving the publication to the channel's
|
|
797
|
+
# history. Not allowed in channels with delta compression.
|
|
798
|
+
# @!attribute [r] tags
|
|
799
|
+
# @return [Hash{String => String}] Attached to the publication: clients cannot send tags, so this
|
|
800
|
+
# is where server-side tag filters get their tags from.
|
|
801
|
+
# @!attribute [r] idempotency_key
|
|
802
|
+
# @return [String] Makes the publication idempotent: another one with the
|
|
803
|
+
# same key in the channel within the broker's idempotency window is not
|
|
804
|
+
# published.
|
|
805
|
+
# @!attribute [r] delta
|
|
806
|
+
# @return [Boolean] Enables delta compression for the publication.
|
|
807
|
+
# @!attribute [r] version
|
|
808
|
+
# @return [Integer] The publication's version, for channels whose publications
|
|
809
|
+
# each carry the whole state: Centrifugo drops one older than the latest.
|
|
810
|
+
# @!attribute [r] version_epoch
|
|
811
|
+
# @return [String] Scopes version, for versions which may start over - when
|
|
812
|
+
# they come from a system which can lose its state, say.
|
|
813
|
+
class PublishResult < Data.define(:data, :b64data, :skip_history, :tags, :idempotency_key, :delta, :version, :version_epoch)
|
|
814
|
+
include Message
|
|
815
|
+
|
|
816
|
+
def initialize(
|
|
817
|
+
data: nil,
|
|
818
|
+
b64data: "",
|
|
819
|
+
skip_history: false,
|
|
820
|
+
tags: {},
|
|
821
|
+
idempotency_key: "",
|
|
822
|
+
delta: false,
|
|
823
|
+
version: 0,
|
|
824
|
+
version_epoch: ""
|
|
825
|
+
)
|
|
826
|
+
super
|
|
827
|
+
end
|
|
828
|
+
|
|
829
|
+
# The message as Centrifugo reads it, fields at their zero value left out.
|
|
830
|
+
#
|
|
831
|
+
# @api private
|
|
832
|
+
def to_wire(where = "")
|
|
833
|
+
w = {}
|
|
834
|
+
Wire.put(w, "data", data, where, :json)
|
|
835
|
+
Wire.put(w, "b64data", b64data, where, :str)
|
|
836
|
+
Wire.put(w, "skip_history", skip_history, where, :bool)
|
|
837
|
+
Wire.put(w, "tags", tags, where, :str, :map)
|
|
838
|
+
Wire.put(w, "idempotency_key", idempotency_key, where, :str)
|
|
839
|
+
Wire.put(w, "delta", delta, where, :bool)
|
|
840
|
+
Wire.put(w, "version", version, where, :int)
|
|
841
|
+
Wire.put(w, "version_epoch", version_epoch, where, :str)
|
|
842
|
+
w
|
|
843
|
+
end
|
|
844
|
+
|
|
845
|
+
# The message from the Hash JSON.parse gives for it.
|
|
846
|
+
#
|
|
847
|
+
# @api private
|
|
848
|
+
def self.from_wire(v, where = "PublishResult")
|
|
849
|
+
d = Wire.obj(v, where)
|
|
850
|
+
new(
|
|
851
|
+
data: Wire.get(d, "data", where, :json),
|
|
852
|
+
b64data: Wire.get(d, "b64data", where, :str),
|
|
853
|
+
skip_history: Wire.get(d, "skip_history", where, :bool),
|
|
854
|
+
tags: Wire.get(d, "tags", where, :str, :map),
|
|
855
|
+
idempotency_key: Wire.get(d, "idempotency_key", where, :str),
|
|
856
|
+
delta: Wire.get(d, "delta", where, :bool),
|
|
857
|
+
version: Wire.get(d, "version", where, :int),
|
|
858
|
+
version_epoch: Wire.get(d, "version_epoch", where, :str)
|
|
859
|
+
)
|
|
860
|
+
end
|
|
861
|
+
end
|
|
862
|
+
|
|
863
|
+
# MapPublishRequest is sent when a client publishes a key into a map channel.
|
|
864
|
+
#
|
|
865
|
+
# @!attribute [r] client
|
|
866
|
+
# @return [String] The unique ID Centrifugo gave the connection.
|
|
867
|
+
# @!attribute [r] transport
|
|
868
|
+
# @return [String] The connection's transport.
|
|
869
|
+
# @!attribute [r] protocol
|
|
870
|
+
# @return [String] The client protocol. One of: json, protobuf.
|
|
871
|
+
# @!attribute [r] encoding
|
|
872
|
+
# @return [String] Binary when the proxy has binary_encoding enabled, so that
|
|
873
|
+
# payloads come in the b64 fields, and json otherwise.
|
|
874
|
+
# One of: json, binary.
|
|
875
|
+
# @!attribute [r] user
|
|
876
|
+
# @return [String] The connection's user ID.
|
|
877
|
+
# @!attribute [r] channel
|
|
878
|
+
# @return [String] The map channel the client publishes into.
|
|
879
|
+
# @!attribute [r] key
|
|
880
|
+
# @return [String] The key the client publishes, empty if it sent none.
|
|
881
|
+
# @!attribute [r] data
|
|
882
|
+
# @return [Object, nil] The data the client publishes.
|
|
883
|
+
# @!attribute [r] b64data
|
|
884
|
+
# @return [String] Data in base64, sent instead of data in binary encoding mode.
|
|
885
|
+
# @!attribute [r] meta
|
|
886
|
+
# @return [Object, nil] The connection's meta, when the proxy has include_connection_meta.
|
|
887
|
+
# @!attribute [r] labels
|
|
888
|
+
# @return [Hash{String => String}] PRO only — connection labels attached to the originating centrifuge.Client.
|
|
889
|
+
# Centrifugo PRO always populates this from Client.Labels() (no opt-in toggle).
|
|
890
|
+
class MapPublishRequest < Data.define(:client, :transport, :protocol, :encoding, :user, :channel, :key, :data, :b64data, :meta, :labels)
|
|
891
|
+
include Message
|
|
892
|
+
|
|
893
|
+
def initialize(
|
|
894
|
+
client: "",
|
|
895
|
+
transport: "",
|
|
896
|
+
protocol: "",
|
|
897
|
+
encoding: "",
|
|
898
|
+
user: "",
|
|
899
|
+
channel: "",
|
|
900
|
+
key: "",
|
|
901
|
+
data: nil,
|
|
902
|
+
b64data: "",
|
|
903
|
+
meta: nil,
|
|
904
|
+
labels: {}
|
|
905
|
+
)
|
|
906
|
+
super
|
|
907
|
+
end
|
|
908
|
+
|
|
909
|
+
# The message as Centrifugo reads it, fields at their zero value left out.
|
|
910
|
+
#
|
|
911
|
+
# @api private
|
|
912
|
+
def to_wire(where = "")
|
|
913
|
+
w = {}
|
|
914
|
+
Wire.put(w, "client", client, where, :str)
|
|
915
|
+
Wire.put(w, "transport", transport, where, :str)
|
|
916
|
+
Wire.put(w, "protocol", protocol, where, :str)
|
|
917
|
+
Wire.put(w, "encoding", encoding, where, :str)
|
|
918
|
+
Wire.put(w, "user", user, where, :str)
|
|
919
|
+
Wire.put(w, "channel", channel, where, :str)
|
|
920
|
+
Wire.put(w, "key", key, where, :str)
|
|
921
|
+
Wire.put(w, "data", data, where, :json)
|
|
922
|
+
Wire.put(w, "b64data", b64data, where, :str)
|
|
923
|
+
Wire.put(w, "meta", meta, where, :json)
|
|
924
|
+
Wire.put(w, "labels", labels, where, :str, :map)
|
|
925
|
+
w
|
|
926
|
+
end
|
|
927
|
+
|
|
928
|
+
# The message from the Hash JSON.parse gives for it.
|
|
929
|
+
#
|
|
930
|
+
# @api private
|
|
931
|
+
def self.from_wire(v, where = "MapPublishRequest")
|
|
932
|
+
d = Wire.obj(v, where)
|
|
933
|
+
new(
|
|
934
|
+
client: Wire.get(d, "client", where, :str),
|
|
935
|
+
transport: Wire.get(d, "transport", where, :str),
|
|
936
|
+
protocol: Wire.get(d, "protocol", where, :str),
|
|
937
|
+
encoding: Wire.get(d, "encoding", where, :str),
|
|
938
|
+
user: Wire.get(d, "user", where, :str),
|
|
939
|
+
channel: Wire.get(d, "channel", where, :str),
|
|
940
|
+
key: Wire.get(d, "key", where, :str),
|
|
941
|
+
data: Wire.get(d, "data", where, :json),
|
|
942
|
+
b64data: Wire.get(d, "b64data", where, :str),
|
|
943
|
+
meta: Wire.get(d, "meta", where, :json),
|
|
944
|
+
labels: Wire.get(d, "labels", where, :str, :map)
|
|
945
|
+
)
|
|
946
|
+
end
|
|
947
|
+
end
|
|
948
|
+
|
|
949
|
+
# MapPublishResult accepts the publication, even when empty. Fields left
|
|
950
|
+
# unset keep what the client sent, or the defaults.
|
|
951
|
+
#
|
|
952
|
+
# @!attribute [r] key
|
|
953
|
+
# @return [String] Replaces the key the client sent: to force a key the server derives,
|
|
954
|
+
# such as the user ID.
|
|
955
|
+
# @!attribute [r] data
|
|
956
|
+
# @return [Object, nil] Replaces the data the client sent.
|
|
957
|
+
# @!attribute [r] b64data
|
|
958
|
+
# @return [String] Data in base64, for binary data.
|
|
959
|
+
# @!attribute [r] tags
|
|
960
|
+
# @return [Hash{String => String}] Attached to the publication: clients cannot send tags, so this
|
|
961
|
+
# is where server-side tag filters get their tags from.
|
|
962
|
+
# @!attribute [r] score
|
|
963
|
+
# @return [Integer] Not used by Centrifugo yet.
|
|
964
|
+
# @!attribute [r] key_mode
|
|
965
|
+
# @return [String] Makes the publication conditional: if_new publishes only a key
|
|
966
|
+
# which does not exist yet, if_exists only one which does.
|
|
967
|
+
# One of: if_new, if_exists.
|
|
968
|
+
# @!attribute [r] stream_data
|
|
969
|
+
# @return [Object, nil] Not used by Centrifugo yet.
|
|
970
|
+
# @!attribute [r] b64stream_data
|
|
971
|
+
# @return [String] Not used by Centrifugo yet.
|
|
972
|
+
# @!attribute [r] idempotency_key
|
|
973
|
+
# @return [String] Makes the publication idempotent: another one with the
|
|
974
|
+
# same key within the broker's idempotency window is not published.
|
|
975
|
+
# @!attribute [r] delta
|
|
976
|
+
# @return [Boolean] Enables delta compression for the publication.
|
|
977
|
+
# @!attribute [r] version
|
|
978
|
+
# @return [Integer] The key's version: Centrifugo drops a publication older than
|
|
979
|
+
# the key's latest.
|
|
980
|
+
# @!attribute [r] version_epoch
|
|
981
|
+
# @return [String] Scopes version, for versions which may start over.
|
|
982
|
+
class MapPublishResult < Data.define(:key, :data, :b64data, :tags, :score, :key_mode, :stream_data, :b64stream_data, :idempotency_key, :delta, :version, :version_epoch)
|
|
983
|
+
include Message
|
|
984
|
+
|
|
985
|
+
def initialize(
|
|
986
|
+
key: "",
|
|
987
|
+
data: nil,
|
|
988
|
+
b64data: "",
|
|
989
|
+
tags: {},
|
|
990
|
+
score: 0,
|
|
991
|
+
key_mode: "",
|
|
992
|
+
stream_data: nil,
|
|
993
|
+
b64stream_data: "",
|
|
994
|
+
idempotency_key: "",
|
|
995
|
+
delta: false,
|
|
996
|
+
version: 0,
|
|
997
|
+
version_epoch: ""
|
|
998
|
+
)
|
|
999
|
+
super
|
|
1000
|
+
end
|
|
1001
|
+
|
|
1002
|
+
# The message as Centrifugo reads it, fields at their zero value left out.
|
|
1003
|
+
#
|
|
1004
|
+
# @api private
|
|
1005
|
+
def to_wire(where = "")
|
|
1006
|
+
w = {}
|
|
1007
|
+
Wire.put(w, "key", key, where, :str)
|
|
1008
|
+
Wire.put(w, "data", data, where, :json)
|
|
1009
|
+
Wire.put(w, "b64data", b64data, where, :str)
|
|
1010
|
+
Wire.put(w, "tags", tags, where, :str, :map)
|
|
1011
|
+
Wire.put(w, "score", score, where, :int)
|
|
1012
|
+
Wire.put(w, "key_mode", key_mode, where, :str)
|
|
1013
|
+
Wire.put(w, "stream_data", stream_data, where, :json)
|
|
1014
|
+
Wire.put(w, "b64stream_data", b64stream_data, where, :str)
|
|
1015
|
+
Wire.put(w, "idempotency_key", idempotency_key, where, :str)
|
|
1016
|
+
Wire.put(w, "delta", delta, where, :bool)
|
|
1017
|
+
Wire.put(w, "version", version, where, :int)
|
|
1018
|
+
Wire.put(w, "version_epoch", version_epoch, where, :str)
|
|
1019
|
+
w
|
|
1020
|
+
end
|
|
1021
|
+
|
|
1022
|
+
# The message from the Hash JSON.parse gives for it.
|
|
1023
|
+
#
|
|
1024
|
+
# @api private
|
|
1025
|
+
def self.from_wire(v, where = "MapPublishResult")
|
|
1026
|
+
d = Wire.obj(v, where)
|
|
1027
|
+
new(
|
|
1028
|
+
key: Wire.get(d, "key", where, :str),
|
|
1029
|
+
data: Wire.get(d, "data", where, :json),
|
|
1030
|
+
b64data: Wire.get(d, "b64data", where, :str),
|
|
1031
|
+
tags: Wire.get(d, "tags", where, :str, :map),
|
|
1032
|
+
score: Wire.get(d, "score", where, :int),
|
|
1033
|
+
key_mode: Wire.get(d, "key_mode", where, :str),
|
|
1034
|
+
stream_data: Wire.get(d, "stream_data", where, :json),
|
|
1035
|
+
b64stream_data: Wire.get(d, "b64stream_data", where, :str),
|
|
1036
|
+
idempotency_key: Wire.get(d, "idempotency_key", where, :str),
|
|
1037
|
+
delta: Wire.get(d, "delta", where, :bool),
|
|
1038
|
+
version: Wire.get(d, "version", where, :int),
|
|
1039
|
+
version_epoch: Wire.get(d, "version_epoch", where, :str)
|
|
1040
|
+
)
|
|
1041
|
+
end
|
|
1042
|
+
end
|
|
1043
|
+
|
|
1044
|
+
# MapRemoveRequest is sent when a client removes a key from a map channel.
|
|
1045
|
+
#
|
|
1046
|
+
# @!attribute [r] client
|
|
1047
|
+
# @return [String] The unique ID Centrifugo gave the connection.
|
|
1048
|
+
# @!attribute [r] transport
|
|
1049
|
+
# @return [String] The connection's transport.
|
|
1050
|
+
# @!attribute [r] protocol
|
|
1051
|
+
# @return [String] The client protocol. One of: json, protobuf.
|
|
1052
|
+
# @!attribute [r] encoding
|
|
1053
|
+
# @return [String] Binary when the proxy has binary_encoding enabled, so that
|
|
1054
|
+
# payloads come in the b64 fields, and json otherwise.
|
|
1055
|
+
# One of: json, binary.
|
|
1056
|
+
# @!attribute [r] user
|
|
1057
|
+
# @return [String] The connection's user ID.
|
|
1058
|
+
# @!attribute [r] channel
|
|
1059
|
+
# @return [String] The map channel the client removes the key from.
|
|
1060
|
+
# @!attribute [r] key
|
|
1061
|
+
# @return [String] The key the client removes.
|
|
1062
|
+
# @!attribute [r] meta
|
|
1063
|
+
# @return [Object, nil] The connection's meta, when the proxy has include_connection_meta.
|
|
1064
|
+
# @!attribute [r] labels
|
|
1065
|
+
# @return [Hash{String => String}] PRO only — connection labels attached to the originating centrifuge.Client.
|
|
1066
|
+
# Centrifugo PRO always populates this from Client.Labels() (no opt-in toggle).
|
|
1067
|
+
class MapRemoveRequest < Data.define(:client, :transport, :protocol, :encoding, :user, :channel, :key, :meta, :labels)
|
|
1068
|
+
include Message
|
|
1069
|
+
|
|
1070
|
+
def initialize(
|
|
1071
|
+
client: "",
|
|
1072
|
+
transport: "",
|
|
1073
|
+
protocol: "",
|
|
1074
|
+
encoding: "",
|
|
1075
|
+
user: "",
|
|
1076
|
+
channel: "",
|
|
1077
|
+
key: "",
|
|
1078
|
+
meta: nil,
|
|
1079
|
+
labels: {}
|
|
1080
|
+
)
|
|
1081
|
+
super
|
|
1082
|
+
end
|
|
1083
|
+
|
|
1084
|
+
# The message as Centrifugo reads it, fields at their zero value left out.
|
|
1085
|
+
#
|
|
1086
|
+
# @api private
|
|
1087
|
+
def to_wire(where = "")
|
|
1088
|
+
w = {}
|
|
1089
|
+
Wire.put(w, "client", client, where, :str)
|
|
1090
|
+
Wire.put(w, "transport", transport, where, :str)
|
|
1091
|
+
Wire.put(w, "protocol", protocol, where, :str)
|
|
1092
|
+
Wire.put(w, "encoding", encoding, where, :str)
|
|
1093
|
+
Wire.put(w, "user", user, where, :str)
|
|
1094
|
+
Wire.put(w, "channel", channel, where, :str)
|
|
1095
|
+
Wire.put(w, "key", key, where, :str)
|
|
1096
|
+
Wire.put(w, "meta", meta, where, :json)
|
|
1097
|
+
Wire.put(w, "labels", labels, where, :str, :map)
|
|
1098
|
+
w
|
|
1099
|
+
end
|
|
1100
|
+
|
|
1101
|
+
# The message from the Hash JSON.parse gives for it.
|
|
1102
|
+
#
|
|
1103
|
+
# @api private
|
|
1104
|
+
def self.from_wire(v, where = "MapRemoveRequest")
|
|
1105
|
+
d = Wire.obj(v, where)
|
|
1106
|
+
new(
|
|
1107
|
+
client: Wire.get(d, "client", where, :str),
|
|
1108
|
+
transport: Wire.get(d, "transport", where, :str),
|
|
1109
|
+
protocol: Wire.get(d, "protocol", where, :str),
|
|
1110
|
+
encoding: Wire.get(d, "encoding", where, :str),
|
|
1111
|
+
user: Wire.get(d, "user", where, :str),
|
|
1112
|
+
channel: Wire.get(d, "channel", where, :str),
|
|
1113
|
+
key: Wire.get(d, "key", where, :str),
|
|
1114
|
+
meta: Wire.get(d, "meta", where, :json),
|
|
1115
|
+
labels: Wire.get(d, "labels", where, :str, :map)
|
|
1116
|
+
)
|
|
1117
|
+
end
|
|
1118
|
+
end
|
|
1119
|
+
|
|
1120
|
+
# MapRemoveResult accepts the removal, even when empty. Fields left unset
|
|
1121
|
+
# keep what the client sent, or the defaults.
|
|
1122
|
+
#
|
|
1123
|
+
# @!attribute [r] key
|
|
1124
|
+
# @return [String] Replaces the key the client sent.
|
|
1125
|
+
# @!attribute [r] tags
|
|
1126
|
+
# @return [Hash{String => String}] Attached to the removal publication. When unset, the removed
|
|
1127
|
+
# entry's own tags are.
|
|
1128
|
+
# @!attribute [r] idempotency_key
|
|
1129
|
+
# @return [String] Makes the removal idempotent within the broker's
|
|
1130
|
+
# idempotency window.
|
|
1131
|
+
class MapRemoveResult < Data.define(:key, :tags, :idempotency_key)
|
|
1132
|
+
include Message
|
|
1133
|
+
|
|
1134
|
+
def initialize(key: "", tags: {}, idempotency_key: "") = super
|
|
1135
|
+
|
|
1136
|
+
# The message as Centrifugo reads it, fields at their zero value left out.
|
|
1137
|
+
#
|
|
1138
|
+
# @api private
|
|
1139
|
+
def to_wire(where = "")
|
|
1140
|
+
w = {}
|
|
1141
|
+
Wire.put(w, "key", key, where, :str)
|
|
1142
|
+
Wire.put(w, "tags", tags, where, :str, :map)
|
|
1143
|
+
Wire.put(w, "idempotency_key", idempotency_key, where, :str)
|
|
1144
|
+
w
|
|
1145
|
+
end
|
|
1146
|
+
|
|
1147
|
+
# The message from the Hash JSON.parse gives for it.
|
|
1148
|
+
#
|
|
1149
|
+
# @api private
|
|
1150
|
+
def self.from_wire(v, where = "MapRemoveResult")
|
|
1151
|
+
d = Wire.obj(v, where)
|
|
1152
|
+
new(
|
|
1153
|
+
key: Wire.get(d, "key", where, :str),
|
|
1154
|
+
tags: Wire.get(d, "tags", where, :str, :map),
|
|
1155
|
+
idempotency_key: Wire.get(d, "idempotency_key", where, :str)
|
|
1156
|
+
)
|
|
1157
|
+
end
|
|
1158
|
+
end
|
|
1159
|
+
|
|
1160
|
+
# RPCRequest is sent when a client makes an RPC call.
|
|
1161
|
+
#
|
|
1162
|
+
# @!attribute [r] client
|
|
1163
|
+
# @return [String] The unique ID Centrifugo gave the connection.
|
|
1164
|
+
# @!attribute [r] transport
|
|
1165
|
+
# @return [String] The connection's transport.
|
|
1166
|
+
# @!attribute [r] protocol
|
|
1167
|
+
# @return [String] The client protocol. One of: json, protobuf.
|
|
1168
|
+
# @!attribute [r] encoding
|
|
1169
|
+
# @return [String] Binary when the proxy has binary_encoding enabled, so that
|
|
1170
|
+
# payloads come in the b64 fields, and json otherwise.
|
|
1171
|
+
# One of: json, binary.
|
|
1172
|
+
# @!attribute [r] user
|
|
1173
|
+
# @return [String] The connection's user ID.
|
|
1174
|
+
# @!attribute [r] method
|
|
1175
|
+
# @return [String] The method the client calls, empty if it named none.
|
|
1176
|
+
# @!attribute [r] data
|
|
1177
|
+
# @return [Object, nil] The data the client sent with the call.
|
|
1178
|
+
# @!attribute [r] b64data
|
|
1179
|
+
# @return [String] Data in base64, sent instead of data in binary encoding mode.
|
|
1180
|
+
# @!attribute [r] meta
|
|
1181
|
+
# @return [Object, nil] The connection's meta, when the proxy has include_connection_meta.
|
|
1182
|
+
# @!attribute [r] labels
|
|
1183
|
+
# @return [Hash{String => String}] PRO only — connection labels attached to the originating centrifuge.Client.
|
|
1184
|
+
# Centrifugo PRO always populates this from Client.Labels() (no opt-in toggle).
|
|
1185
|
+
class RPCRequest < Data.define(:client, :transport, :protocol, :encoding, :user, :method, :data, :b64data, :meta, :labels)
|
|
1186
|
+
include Message
|
|
1187
|
+
|
|
1188
|
+
def initialize(
|
|
1189
|
+
client: "",
|
|
1190
|
+
transport: "",
|
|
1191
|
+
protocol: "",
|
|
1192
|
+
encoding: "",
|
|
1193
|
+
user: "",
|
|
1194
|
+
method: "",
|
|
1195
|
+
data: nil,
|
|
1196
|
+
b64data: "",
|
|
1197
|
+
meta: nil,
|
|
1198
|
+
labels: {}
|
|
1199
|
+
)
|
|
1200
|
+
super
|
|
1201
|
+
end
|
|
1202
|
+
|
|
1203
|
+
# The message as Centrifugo reads it, fields at their zero value left out.
|
|
1204
|
+
#
|
|
1205
|
+
# @api private
|
|
1206
|
+
def to_wire(where = "")
|
|
1207
|
+
w = {}
|
|
1208
|
+
Wire.put(w, "client", client, where, :str)
|
|
1209
|
+
Wire.put(w, "transport", transport, where, :str)
|
|
1210
|
+
Wire.put(w, "protocol", protocol, where, :str)
|
|
1211
|
+
Wire.put(w, "encoding", encoding, where, :str)
|
|
1212
|
+
Wire.put(w, "user", user, where, :str)
|
|
1213
|
+
Wire.put(w, "method", method, where, :str)
|
|
1214
|
+
Wire.put(w, "data", data, where, :json)
|
|
1215
|
+
Wire.put(w, "b64data", b64data, where, :str)
|
|
1216
|
+
Wire.put(w, "meta", meta, where, :json)
|
|
1217
|
+
Wire.put(w, "labels", labels, where, :str, :map)
|
|
1218
|
+
w
|
|
1219
|
+
end
|
|
1220
|
+
|
|
1221
|
+
# The message from the Hash JSON.parse gives for it.
|
|
1222
|
+
#
|
|
1223
|
+
# @api private
|
|
1224
|
+
def self.from_wire(v, where = "RPCRequest")
|
|
1225
|
+
d = Wire.obj(v, where)
|
|
1226
|
+
new(
|
|
1227
|
+
client: Wire.get(d, "client", where, :str),
|
|
1228
|
+
transport: Wire.get(d, "transport", where, :str),
|
|
1229
|
+
protocol: Wire.get(d, "protocol", where, :str),
|
|
1230
|
+
encoding: Wire.get(d, "encoding", where, :str),
|
|
1231
|
+
user: Wire.get(d, "user", where, :str),
|
|
1232
|
+
method: Wire.get(d, "method", where, :str),
|
|
1233
|
+
data: Wire.get(d, "data", where, :json),
|
|
1234
|
+
b64data: Wire.get(d, "b64data", where, :str),
|
|
1235
|
+
meta: Wire.get(d, "meta", where, :json),
|
|
1236
|
+
labels: Wire.get(d, "labels", where, :str, :map)
|
|
1237
|
+
)
|
|
1238
|
+
end
|
|
1239
|
+
end
|
|
1240
|
+
|
|
1241
|
+
# RPCResult is the call's result.
|
|
1242
|
+
#
|
|
1243
|
+
# @!attribute [r] data
|
|
1244
|
+
# @return [Object, nil] The result sent to the client: any JSON.
|
|
1245
|
+
# @!attribute [r] b64data
|
|
1246
|
+
# @return [String] Data in base64, for binary data.
|
|
1247
|
+
class RPCResult < Data.define(:data, :b64data)
|
|
1248
|
+
include Message
|
|
1249
|
+
|
|
1250
|
+
def initialize(data: nil, b64data: "") = super
|
|
1251
|
+
|
|
1252
|
+
# The message as Centrifugo reads it, fields at their zero value left out.
|
|
1253
|
+
#
|
|
1254
|
+
# @api private
|
|
1255
|
+
def to_wire(where = "")
|
|
1256
|
+
w = {}
|
|
1257
|
+
Wire.put(w, "data", data, where, :json)
|
|
1258
|
+
Wire.put(w, "b64data", b64data, where, :str)
|
|
1259
|
+
w
|
|
1260
|
+
end
|
|
1261
|
+
|
|
1262
|
+
# The message from the Hash JSON.parse gives for it.
|
|
1263
|
+
#
|
|
1264
|
+
# @api private
|
|
1265
|
+
def self.from_wire(v, where = "RPCResult")
|
|
1266
|
+
d = Wire.obj(v, where)
|
|
1267
|
+
new(
|
|
1268
|
+
data: Wire.get(d, "data", where, :json),
|
|
1269
|
+
b64data: Wire.get(d, "b64data", where, :str)
|
|
1270
|
+
)
|
|
1271
|
+
end
|
|
1272
|
+
end
|
|
1273
|
+
|
|
1274
|
+
# SubRefreshRequest is sent when a subscription is about to expire.
|
|
1275
|
+
#
|
|
1276
|
+
# @!attribute [r] client
|
|
1277
|
+
# @return [String] The unique ID Centrifugo gave the connection.
|
|
1278
|
+
# @!attribute [r] transport
|
|
1279
|
+
# @return [String] The connection's transport.
|
|
1280
|
+
# @!attribute [r] protocol
|
|
1281
|
+
# @return [String] The client protocol. One of: json, protobuf.
|
|
1282
|
+
# @!attribute [r] encoding
|
|
1283
|
+
# @return [String] Binary when the proxy has binary_encoding enabled, so that
|
|
1284
|
+
# payloads come in the b64 fields, and json otherwise.
|
|
1285
|
+
# One of: json, binary.
|
|
1286
|
+
# @!attribute [r] user
|
|
1287
|
+
# @return [String] The connection's user ID.
|
|
1288
|
+
# @!attribute [r] channel
|
|
1289
|
+
# @return [String] The channel whose subscription is about to expire.
|
|
1290
|
+
# @!attribute [r] meta
|
|
1291
|
+
# @return [Object, nil] The connection's meta, when the proxy has include_connection_meta.
|
|
1292
|
+
# @!attribute [r] labels
|
|
1293
|
+
# @return [Hash{String => String}] PRO only — connection labels attached to the originating centrifuge.Client.
|
|
1294
|
+
# Centrifugo PRO always populates this from Client.Labels() (no opt-in toggle).
|
|
1295
|
+
class SubRefreshRequest < Data.define(:client, :transport, :protocol, :encoding, :user, :channel, :meta, :labels)
|
|
1296
|
+
include Message
|
|
1297
|
+
|
|
1298
|
+
def initialize(
|
|
1299
|
+
client: "",
|
|
1300
|
+
transport: "",
|
|
1301
|
+
protocol: "",
|
|
1302
|
+
encoding: "",
|
|
1303
|
+
user: "",
|
|
1304
|
+
channel: "",
|
|
1305
|
+
meta: nil,
|
|
1306
|
+
labels: {}
|
|
1307
|
+
)
|
|
1308
|
+
super
|
|
1309
|
+
end
|
|
1310
|
+
|
|
1311
|
+
# The message as Centrifugo reads it, fields at their zero value left out.
|
|
1312
|
+
#
|
|
1313
|
+
# @api private
|
|
1314
|
+
def to_wire(where = "")
|
|
1315
|
+
w = {}
|
|
1316
|
+
Wire.put(w, "client", client, where, :str)
|
|
1317
|
+
Wire.put(w, "transport", transport, where, :str)
|
|
1318
|
+
Wire.put(w, "protocol", protocol, where, :str)
|
|
1319
|
+
Wire.put(w, "encoding", encoding, where, :str)
|
|
1320
|
+
Wire.put(w, "user", user, where, :str)
|
|
1321
|
+
Wire.put(w, "channel", channel, where, :str)
|
|
1322
|
+
Wire.put(w, "meta", meta, where, :json)
|
|
1323
|
+
Wire.put(w, "labels", labels, where, :str, :map)
|
|
1324
|
+
w
|
|
1325
|
+
end
|
|
1326
|
+
|
|
1327
|
+
# The message from the Hash JSON.parse gives for it.
|
|
1328
|
+
#
|
|
1329
|
+
# @api private
|
|
1330
|
+
def self.from_wire(v, where = "SubRefreshRequest")
|
|
1331
|
+
d = Wire.obj(v, where)
|
|
1332
|
+
new(
|
|
1333
|
+
client: Wire.get(d, "client", where, :str),
|
|
1334
|
+
transport: Wire.get(d, "transport", where, :str),
|
|
1335
|
+
protocol: Wire.get(d, "protocol", where, :str),
|
|
1336
|
+
encoding: Wire.get(d, "encoding", where, :str),
|
|
1337
|
+
user: Wire.get(d, "user", where, :str),
|
|
1338
|
+
channel: Wire.get(d, "channel", where, :str),
|
|
1339
|
+
meta: Wire.get(d, "meta", where, :json),
|
|
1340
|
+
labels: Wire.get(d, "labels", where, :str, :map)
|
|
1341
|
+
)
|
|
1342
|
+
end
|
|
1343
|
+
end
|
|
1344
|
+
|
|
1345
|
+
# SubRefreshResult extends the subscription, or ends it.
|
|
1346
|
+
#
|
|
1347
|
+
# @!attribute [r] expired
|
|
1348
|
+
# @return [Boolean] Ends the subscription: it has expired.
|
|
1349
|
+
# @!attribute [r] expire_at
|
|
1350
|
+
# @return [Integer] When the subscription expires next, in Unix seconds.
|
|
1351
|
+
# @!attribute [r] info
|
|
1352
|
+
# @return [Object, nil] Replaces the channel-specific information about the connection, as
|
|
1353
|
+
# JSON.
|
|
1354
|
+
# @!attribute [r] b64info
|
|
1355
|
+
# @return [String] Info in base64, for binary info.
|
|
1356
|
+
# @!attribute [r] server_tags_filter
|
|
1357
|
+
# @return [FilterNode, nil] When set, replaces the server-side tags filter of the
|
|
1358
|
+
# subscription (Centrifugo PRO). When not set the filter is kept as it is.
|
|
1359
|
+
class SubRefreshResult < Data.define(:expired, :expire_at, :info, :b64info, :server_tags_filter)
|
|
1360
|
+
include Message
|
|
1361
|
+
|
|
1362
|
+
def initialize(
|
|
1363
|
+
expired: false,
|
|
1364
|
+
expire_at: 0,
|
|
1365
|
+
info: nil,
|
|
1366
|
+
b64info: "",
|
|
1367
|
+
server_tags_filter: nil
|
|
1368
|
+
)
|
|
1369
|
+
super
|
|
1370
|
+
end
|
|
1371
|
+
|
|
1372
|
+
# The message as Centrifugo reads it, fields at their zero value left out.
|
|
1373
|
+
#
|
|
1374
|
+
# @api private
|
|
1375
|
+
def to_wire(where = "")
|
|
1376
|
+
w = {}
|
|
1377
|
+
Wire.put(w, "expired", expired, where, :bool)
|
|
1378
|
+
Wire.put(w, "expire_at", expire_at, where, :int)
|
|
1379
|
+
Wire.put(w, "info", info, where, :json)
|
|
1380
|
+
Wire.put(w, "b64info", b64info, where, :str)
|
|
1381
|
+
Wire.put(w, "server_tags_filter", server_tags_filter, where, FilterNode)
|
|
1382
|
+
w
|
|
1383
|
+
end
|
|
1384
|
+
|
|
1385
|
+
# The message from the Hash JSON.parse gives for it.
|
|
1386
|
+
#
|
|
1387
|
+
# @api private
|
|
1388
|
+
def self.from_wire(v, where = "SubRefreshResult")
|
|
1389
|
+
d = Wire.obj(v, where)
|
|
1390
|
+
new(
|
|
1391
|
+
expired: Wire.get(d, "expired", where, :bool),
|
|
1392
|
+
expire_at: Wire.get(d, "expire_at", where, :int),
|
|
1393
|
+
info: Wire.get(d, "info", where, :json),
|
|
1394
|
+
b64info: Wire.get(d, "b64info", where, :str),
|
|
1395
|
+
server_tags_filter: Wire.get(d, "server_tags_filter", where, FilterNode)
|
|
1396
|
+
)
|
|
1397
|
+
end
|
|
1398
|
+
end
|
|
1399
|
+
|
|
1400
|
+
# NotifyCacheEmptyRequest is sent when a client subscribed to a channel in
|
|
1401
|
+
# cache recovery mode which has no publication to recover from. Centrifugo
|
|
1402
|
+
# PRO only.
|
|
1403
|
+
#
|
|
1404
|
+
# @!attribute [r] channel
|
|
1405
|
+
# @return [String] The channel whose cache is empty.
|
|
1406
|
+
class NotifyCacheEmptyRequest < Data.define(:channel)
|
|
1407
|
+
include Message
|
|
1408
|
+
|
|
1409
|
+
def initialize(channel: "") = super
|
|
1410
|
+
|
|
1411
|
+
# The message as Centrifugo reads it, fields at their zero value left out.
|
|
1412
|
+
#
|
|
1413
|
+
# @api private
|
|
1414
|
+
def to_wire(where = "")
|
|
1415
|
+
w = {}
|
|
1416
|
+
Wire.put(w, "channel", channel, where, :str)
|
|
1417
|
+
w
|
|
1418
|
+
end
|
|
1419
|
+
|
|
1420
|
+
# The message from the Hash JSON.parse gives for it.
|
|
1421
|
+
#
|
|
1422
|
+
# @api private
|
|
1423
|
+
def self.from_wire(v, where = "NotifyCacheEmptyRequest")
|
|
1424
|
+
d = Wire.obj(v, where)
|
|
1425
|
+
new(
|
|
1426
|
+
channel: Wire.get(d, "channel", where, :str)
|
|
1427
|
+
)
|
|
1428
|
+
end
|
|
1429
|
+
end
|
|
1430
|
+
|
|
1431
|
+
# NotifyCacheEmptyResult is the NotifyCacheEmptyResult message of the Centrifugo proxy protocol.
|
|
1432
|
+
#
|
|
1433
|
+
# @!attribute [r] populated
|
|
1434
|
+
# @return [Boolean] Tells Centrifugo that the backend published into the channel,
|
|
1435
|
+
# so that it tries to recover the state once more.
|
|
1436
|
+
class NotifyCacheEmptyResult < Data.define(:populated)
|
|
1437
|
+
include Message
|
|
1438
|
+
|
|
1439
|
+
def initialize(populated: false) = super
|
|
1440
|
+
|
|
1441
|
+
# The message as Centrifugo reads it, fields at their zero value left out.
|
|
1442
|
+
#
|
|
1443
|
+
# @api private
|
|
1444
|
+
def to_wire(where = "")
|
|
1445
|
+
w = {}
|
|
1446
|
+
Wire.put(w, "populated", populated, where, :bool)
|
|
1447
|
+
w
|
|
1448
|
+
end
|
|
1449
|
+
|
|
1450
|
+
# The message from the Hash JSON.parse gives for it.
|
|
1451
|
+
#
|
|
1452
|
+
# @api private
|
|
1453
|
+
def self.from_wire(v, where = "NotifyCacheEmptyResult")
|
|
1454
|
+
d = Wire.obj(v, where)
|
|
1455
|
+
new(
|
|
1456
|
+
populated: Wire.get(d, "populated", where, :bool)
|
|
1457
|
+
)
|
|
1458
|
+
end
|
|
1459
|
+
end
|
|
1460
|
+
|
|
1461
|
+
# NotifyChannelStateRequest carries channel state events. Centrifugo PRO
|
|
1462
|
+
# only, in preview.
|
|
1463
|
+
#
|
|
1464
|
+
# @!attribute [r] events
|
|
1465
|
+
# @return [Array<ChannelEvent>] The events which happened, in channels with presence.
|
|
1466
|
+
class NotifyChannelStateRequest < Data.define(:events)
|
|
1467
|
+
include Message
|
|
1468
|
+
|
|
1469
|
+
def initialize(events: []) = super
|
|
1470
|
+
|
|
1471
|
+
# The message as Centrifugo reads it, fields at their zero value left out.
|
|
1472
|
+
#
|
|
1473
|
+
# @api private
|
|
1474
|
+
def to_wire(where = "")
|
|
1475
|
+
w = {}
|
|
1476
|
+
Wire.put(w, "events", events, where, ChannelEvent, :list)
|
|
1477
|
+
w
|
|
1478
|
+
end
|
|
1479
|
+
|
|
1480
|
+
# The message from the Hash JSON.parse gives for it.
|
|
1481
|
+
#
|
|
1482
|
+
# @api private
|
|
1483
|
+
def self.from_wire(v, where = "NotifyChannelStateRequest")
|
|
1484
|
+
d = Wire.obj(v, where)
|
|
1485
|
+
new(
|
|
1486
|
+
events: Wire.get(d, "events", where, ChannelEvent, :list)
|
|
1487
|
+
)
|
|
1488
|
+
end
|
|
1489
|
+
end
|
|
1490
|
+
|
|
1491
|
+
# ChannelEvent is a change of a channel's state.
|
|
1492
|
+
#
|
|
1493
|
+
# @!attribute [r] time_ms
|
|
1494
|
+
# @return [Integer] When it happened, in Unix milliseconds.
|
|
1495
|
+
# @!attribute [r] channel
|
|
1496
|
+
# @return [String] The channel it happened in.
|
|
1497
|
+
# @!attribute [r] type
|
|
1498
|
+
# @return [String] Occupied when the channel got its first subscriber, vacated
|
|
1499
|
+
# when it lost its last one. More types may come; the field is a string,
|
|
1500
|
+
# not an enum, for JSON interoperability. One of: occupied, vacated.
|
|
1501
|
+
class ChannelEvent < Data.define(:time_ms, :channel, :type)
|
|
1502
|
+
include Message
|
|
1503
|
+
|
|
1504
|
+
def initialize(time_ms: 0, channel: "", type: "") = super
|
|
1505
|
+
|
|
1506
|
+
# The message as Centrifugo reads it, fields at their zero value left out.
|
|
1507
|
+
#
|
|
1508
|
+
# @api private
|
|
1509
|
+
def to_wire(where = "")
|
|
1510
|
+
w = {}
|
|
1511
|
+
Wire.put(w, "time_ms", time_ms, where, :int)
|
|
1512
|
+
Wire.put(w, "channel", channel, where, :str)
|
|
1513
|
+
Wire.put(w, "type", type, where, :str)
|
|
1514
|
+
w
|
|
1515
|
+
end
|
|
1516
|
+
|
|
1517
|
+
# The message from the Hash JSON.parse gives for it.
|
|
1518
|
+
#
|
|
1519
|
+
# @api private
|
|
1520
|
+
def self.from_wire(v, where = "ChannelEvent")
|
|
1521
|
+
d = Wire.obj(v, where)
|
|
1522
|
+
new(
|
|
1523
|
+
time_ms: Wire.get(d, "time_ms", where, :int),
|
|
1524
|
+
channel: Wire.get(d, "channel", where, :str),
|
|
1525
|
+
type: Wire.get(d, "type", where, :str)
|
|
1526
|
+
)
|
|
1527
|
+
end
|
|
1528
|
+
end
|
|
1529
|
+
|
|
1530
|
+
# NotifyChannelStateResult is the NotifyChannelStateResult message of the Centrifugo proxy protocol.
|
|
1531
|
+
class NotifyChannelStateResult < Data.define
|
|
1532
|
+
include Message
|
|
1533
|
+
|
|
1534
|
+
# The message as Centrifugo reads it, fields at their zero value left out.
|
|
1535
|
+
#
|
|
1536
|
+
# @api private
|
|
1537
|
+
def to_wire(_where = "")
|
|
1538
|
+
{}
|
|
1539
|
+
end
|
|
1540
|
+
|
|
1541
|
+
# The message from the Hash JSON.parse gives for it.
|
|
1542
|
+
#
|
|
1543
|
+
# @api private
|
|
1544
|
+
def self.from_wire(v, where = "NotifyChannelStateResult")
|
|
1545
|
+
Wire.obj(v, where)
|
|
1546
|
+
new
|
|
1547
|
+
end
|
|
1548
|
+
end
|
|
1549
|
+
|
|
1550
|
+
# SharedPollRefreshRequest asks for the current data of items tracked in a
|
|
1551
|
+
# shared poll channel.
|
|
1552
|
+
#
|
|
1553
|
+
# @!attribute [r] channel
|
|
1554
|
+
# @return [String] The shared poll channel.
|
|
1555
|
+
# @!attribute [r] items
|
|
1556
|
+
# @return [Array<SharedPollRefreshItem>] The tracked items to refresh.
|
|
1557
|
+
class SharedPollRefreshRequest < Data.define(:channel, :items)
|
|
1558
|
+
include Message
|
|
1559
|
+
|
|
1560
|
+
def initialize(channel: "", items: []) = super
|
|
1561
|
+
|
|
1562
|
+
# The message as Centrifugo reads it, fields at their zero value left out.
|
|
1563
|
+
#
|
|
1564
|
+
# @api private
|
|
1565
|
+
def to_wire(where = "")
|
|
1566
|
+
w = {}
|
|
1567
|
+
Wire.put(w, "channel", channel, where, :str)
|
|
1568
|
+
Wire.put(w, "items", items, where, SharedPollRefreshItem, :list)
|
|
1569
|
+
w
|
|
1570
|
+
end
|
|
1571
|
+
|
|
1572
|
+
# The message from the Hash JSON.parse gives for it.
|
|
1573
|
+
#
|
|
1574
|
+
# @api private
|
|
1575
|
+
def self.from_wire(v, where = "SharedPollRefreshRequest")
|
|
1576
|
+
d = Wire.obj(v, where)
|
|
1577
|
+
new(
|
|
1578
|
+
channel: Wire.get(d, "channel", where, :str),
|
|
1579
|
+
items: Wire.get(d, "items", where, SharedPollRefreshItem, :list)
|
|
1580
|
+
)
|
|
1581
|
+
end
|
|
1582
|
+
end
|
|
1583
|
+
|
|
1584
|
+
# SharedPollRefreshItem is an item to refresh.
|
|
1585
|
+
#
|
|
1586
|
+
# @!attribute [r] key
|
|
1587
|
+
# @return [String] The item's key.
|
|
1588
|
+
# @!attribute [r] version
|
|
1589
|
+
# @return [Integer] The latest version of the item Centrifugo has, in versioned
|
|
1590
|
+
# mode: zero when it has none. Not set in versionless mode.
|
|
1591
|
+
class SharedPollRefreshItem < Data.define(:key, :version)
|
|
1592
|
+
include Message
|
|
1593
|
+
|
|
1594
|
+
def initialize(key: "", version: 0) = super
|
|
1595
|
+
|
|
1596
|
+
# The message as Centrifugo reads it, fields at their zero value left out.
|
|
1597
|
+
#
|
|
1598
|
+
# @api private
|
|
1599
|
+
def to_wire(where = "")
|
|
1600
|
+
w = {}
|
|
1601
|
+
Wire.put(w, "key", key, where, :str)
|
|
1602
|
+
Wire.put(w, "version", version, where, :int)
|
|
1603
|
+
w
|
|
1604
|
+
end
|
|
1605
|
+
|
|
1606
|
+
# The message from the Hash JSON.parse gives for it.
|
|
1607
|
+
#
|
|
1608
|
+
# @api private
|
|
1609
|
+
def self.from_wire(v, where = "SharedPollRefreshItem")
|
|
1610
|
+
d = Wire.obj(v, where)
|
|
1611
|
+
new(
|
|
1612
|
+
key: Wire.get(d, "key", where, :str),
|
|
1613
|
+
version: Wire.get(d, "version", where, :int)
|
|
1614
|
+
)
|
|
1615
|
+
end
|
|
1616
|
+
end
|
|
1617
|
+
|
|
1618
|
+
# SharedPollRefreshResult carries the items' current data. An item left out
|
|
1619
|
+
# is unchanged.
|
|
1620
|
+
#
|
|
1621
|
+
# @!attribute [r] items
|
|
1622
|
+
# @return [Array<SharedPollRefreshResultItem>] The items' current data.
|
|
1623
|
+
# @!attribute [r] epoch
|
|
1624
|
+
# @return [String] Identifies the publisher's version space: when it differs from
|
|
1625
|
+
# the channel's, Centrifugo drops the versions and data it keeps and
|
|
1626
|
+
# resubscribes the channel's subscribers. Generate one per process start, and
|
|
1627
|
+
# send the same one with direct publishes. Empty means versions are never
|
|
1628
|
+
# reset.
|
|
1629
|
+
class SharedPollRefreshResult < Data.define(:items, :epoch)
|
|
1630
|
+
include Message
|
|
1631
|
+
|
|
1632
|
+
def initialize(items: [], epoch: "") = super
|
|
1633
|
+
|
|
1634
|
+
# The message as Centrifugo reads it, fields at their zero value left out.
|
|
1635
|
+
#
|
|
1636
|
+
# @api private
|
|
1637
|
+
def to_wire(where = "")
|
|
1638
|
+
w = {}
|
|
1639
|
+
Wire.put(w, "items", items, where, SharedPollRefreshResultItem, :list)
|
|
1640
|
+
Wire.put(w, "epoch", epoch, where, :str)
|
|
1641
|
+
w
|
|
1642
|
+
end
|
|
1643
|
+
|
|
1644
|
+
# The message from the Hash JSON.parse gives for it.
|
|
1645
|
+
#
|
|
1646
|
+
# @api private
|
|
1647
|
+
def self.from_wire(v, where = "SharedPollRefreshResult")
|
|
1648
|
+
d = Wire.obj(v, where)
|
|
1649
|
+
new(
|
|
1650
|
+
items: Wire.get(d, "items", where, SharedPollRefreshResultItem, :list),
|
|
1651
|
+
epoch: Wire.get(d, "epoch", where, :str)
|
|
1652
|
+
)
|
|
1653
|
+
end
|
|
1654
|
+
end
|
|
1655
|
+
|
|
1656
|
+
# SharedPollRefreshResultItem is an item's current data.
|
|
1657
|
+
#
|
|
1658
|
+
# @!attribute [r] key
|
|
1659
|
+
# @return [String] The item's key.
|
|
1660
|
+
# @!attribute [r] data
|
|
1661
|
+
# @return [Object, nil] The item's data. In versioned mode it may be left out for an
|
|
1662
|
+
# item which has not changed.
|
|
1663
|
+
# @!attribute [r] version
|
|
1664
|
+
# @return [Integer] The item's version: required in versioned mode, optional in
|
|
1665
|
+
# versionless mode. It must grow when the item changes.
|
|
1666
|
+
# @!attribute [r] removed
|
|
1667
|
+
# @return [Boolean] Removes the item: subscribers are told so, and it is no longer
|
|
1668
|
+
# tracked.
|
|
1669
|
+
# @!attribute [r] prev_data
|
|
1670
|
+
# @return [Object, nil] The item's previous data, the base for delta compression
|
|
1671
|
+
# when the namespace uses it, so that Centrifugo need not keep it.
|
|
1672
|
+
class SharedPollRefreshResultItem < Data.define(:key, :data, :version, :removed, :prev_data)
|
|
1673
|
+
include Message
|
|
1674
|
+
|
|
1675
|
+
def initialize(
|
|
1676
|
+
key: "",
|
|
1677
|
+
data: nil,
|
|
1678
|
+
version: 0,
|
|
1679
|
+
removed: false,
|
|
1680
|
+
prev_data: nil
|
|
1681
|
+
)
|
|
1682
|
+
super
|
|
1683
|
+
end
|
|
1684
|
+
|
|
1685
|
+
# The message as Centrifugo reads it, fields at their zero value left out.
|
|
1686
|
+
#
|
|
1687
|
+
# @api private
|
|
1688
|
+
def to_wire(where = "")
|
|
1689
|
+
w = {}
|
|
1690
|
+
Wire.put(w, "key", key, where, :str)
|
|
1691
|
+
Wire.put(w, "data", data, where, :json)
|
|
1692
|
+
Wire.put(w, "version", version, where, :int)
|
|
1693
|
+
Wire.put(w, "removed", removed, where, :bool)
|
|
1694
|
+
Wire.put(w, "prev_data", prev_data, where, :json)
|
|
1695
|
+
w
|
|
1696
|
+
end
|
|
1697
|
+
|
|
1698
|
+
# The message from the Hash JSON.parse gives for it.
|
|
1699
|
+
#
|
|
1700
|
+
# @api private
|
|
1701
|
+
def self.from_wire(v, where = "SharedPollRefreshResultItem")
|
|
1702
|
+
d = Wire.obj(v, where)
|
|
1703
|
+
new(
|
|
1704
|
+
key: Wire.get(d, "key", where, :str),
|
|
1705
|
+
data: Wire.get(d, "data", where, :json),
|
|
1706
|
+
version: Wire.get(d, "version", where, :int),
|
|
1707
|
+
removed: Wire.get(d, "removed", where, :bool),
|
|
1708
|
+
prev_data: Wire.get(d, "prev_data", where, :json)
|
|
1709
|
+
)
|
|
1710
|
+
end
|
|
1711
|
+
end
|
|
1712
|
+
|
|
1713
|
+
# The values of FilterNode.op. The field is a String: a value Centrifugo sends
|
|
1714
|
+
# or accepts which these do not name is still a valid one.
|
|
1715
|
+
|
|
1716
|
+
# The FilterNodeOp "and".
|
|
1717
|
+
FILTER_NODE_OP_AND = "and"
|
|
1718
|
+
|
|
1719
|
+
# The FilterNodeOp "or".
|
|
1720
|
+
FILTER_NODE_OP_OR = "or"
|
|
1721
|
+
|
|
1722
|
+
# The FilterNodeOp "not".
|
|
1723
|
+
FILTER_NODE_OP_NOT = "not"
|
|
1724
|
+
|
|
1725
|
+
# The values of FilterNode.cmp. The field is a String: a value Centrifugo
|
|
1726
|
+
# sends or accepts which these do not name is still a valid one.
|
|
1727
|
+
|
|
1728
|
+
# The Cmp "eq".
|
|
1729
|
+
CMP_EQ = "eq"
|
|
1730
|
+
|
|
1731
|
+
# The Cmp "neq".
|
|
1732
|
+
CMP_NEQ = "neq"
|
|
1733
|
+
|
|
1734
|
+
# The Cmp "in".
|
|
1735
|
+
CMP_IN = "in"
|
|
1736
|
+
|
|
1737
|
+
# The Cmp "nin".
|
|
1738
|
+
CMP_NIN = "nin"
|
|
1739
|
+
|
|
1740
|
+
# The Cmp "ex".
|
|
1741
|
+
CMP_EX = "ex"
|
|
1742
|
+
|
|
1743
|
+
# The Cmp "nex".
|
|
1744
|
+
CMP_NEX = "nex"
|
|
1745
|
+
|
|
1746
|
+
# The Cmp "sw".
|
|
1747
|
+
CMP_SW = "sw"
|
|
1748
|
+
|
|
1749
|
+
# The Cmp "ew".
|
|
1750
|
+
CMP_EW = "ew"
|
|
1751
|
+
|
|
1752
|
+
# The Cmp "ct".
|
|
1753
|
+
CMP_CT = "ct"
|
|
1754
|
+
|
|
1755
|
+
# The Cmp "gt".
|
|
1756
|
+
CMP_GT = "gt"
|
|
1757
|
+
|
|
1758
|
+
# The Cmp "gte".
|
|
1759
|
+
CMP_GTE = "gte"
|
|
1760
|
+
|
|
1761
|
+
# The Cmp "lt".
|
|
1762
|
+
CMP_LT = "lt"
|
|
1763
|
+
|
|
1764
|
+
# The Cmp "lte".
|
|
1765
|
+
CMP_LTE = "lte"
|
|
1766
|
+
|
|
1767
|
+
# The values of ConnectRequest.protocol, RefreshRequest.protocol,
|
|
1768
|
+
# SubscribeRequest.protocol, PublishRequest.protocol,
|
|
1769
|
+
# MapPublishRequest.protocol, MapRemoveRequest.protocol, RPCRequest.protocol
|
|
1770
|
+
# and SubRefreshRequest.protocol. The field is a String: a value Centrifugo
|
|
1771
|
+
# sends or accepts which these do not name is still a valid one.
|
|
1772
|
+
|
|
1773
|
+
# The Protocol "json".
|
|
1774
|
+
PROTOCOL_JSON = "json"
|
|
1775
|
+
|
|
1776
|
+
# The Protocol "protobuf".
|
|
1777
|
+
PROTOCOL_PROTOBUF = "protobuf"
|
|
1778
|
+
|
|
1779
|
+
# The values of ConnectRequest.encoding, RefreshRequest.encoding,
|
|
1780
|
+
# SubscribeRequest.encoding, PublishRequest.encoding,
|
|
1781
|
+
# MapPublishRequest.encoding, MapRemoveRequest.encoding, RPCRequest.encoding
|
|
1782
|
+
# and SubRefreshRequest.encoding. The field is a String: a value Centrifugo
|
|
1783
|
+
# sends or accepts which these do not name is still a valid one.
|
|
1784
|
+
|
|
1785
|
+
# The Encoding "json".
|
|
1786
|
+
ENCODING_JSON = "json"
|
|
1787
|
+
|
|
1788
|
+
# The Encoding "binary".
|
|
1789
|
+
ENCODING_BINARY = "binary"
|
|
1790
|
+
|
|
1791
|
+
# The values of ChannelsCapability.allow and SubscribeResult.allow. The field
|
|
1792
|
+
# is a String: a value Centrifugo sends or accepts which these do not name is
|
|
1793
|
+
# still a valid one.
|
|
1794
|
+
|
|
1795
|
+
# The Allow "sub".
|
|
1796
|
+
ALLOW_SUB = "sub"
|
|
1797
|
+
|
|
1798
|
+
# The Allow "pub".
|
|
1799
|
+
ALLOW_PUB = "pub"
|
|
1800
|
+
|
|
1801
|
+
# The Allow "hst".
|
|
1802
|
+
ALLOW_HST = "hst"
|
|
1803
|
+
|
|
1804
|
+
# The Allow "prs".
|
|
1805
|
+
ALLOW_PRS = "prs"
|
|
1806
|
+
|
|
1807
|
+
# The values of ChannelsCapability.match. The field is a String: a value
|
|
1808
|
+
# Centrifugo sends or accepts which these do not name is still a valid one.
|
|
1809
|
+
|
|
1810
|
+
# The CapabilityMatch "wildcard".
|
|
1811
|
+
CAPABILITY_MATCH_WILDCARD = "wildcard"
|
|
1812
|
+
|
|
1813
|
+
# The CapabilityMatch "regex".
|
|
1814
|
+
CAPABILITY_MATCH_REGEX = "regex"
|
|
1815
|
+
|
|
1816
|
+
# The values of MapPublishResult.key_mode. The field is a String: a value
|
|
1817
|
+
# Centrifugo sends or accepts which these do not name is still a valid one.
|
|
1818
|
+
|
|
1819
|
+
# The KeyMode "if_new".
|
|
1820
|
+
KEY_MODE_IF_NEW = "if_new"
|
|
1821
|
+
|
|
1822
|
+
# The KeyMode "if_exists".
|
|
1823
|
+
KEY_MODE_IF_EXISTS = "if_exists"
|
|
1824
|
+
|
|
1825
|
+
# The values of ChannelEvent.type. The field is a String: a value Centrifugo
|
|
1826
|
+
# sends or accepts which these do not name is still a valid one.
|
|
1827
|
+
|
|
1828
|
+
# The ChannelEventType "occupied".
|
|
1829
|
+
CHANNEL_EVENT_TYPE_OCCUPIED = "occupied"
|
|
1830
|
+
|
|
1831
|
+
# The ChannelEventType "vacated".
|
|
1832
|
+
CHANNEL_EVENT_TYPE_VACATED = "vacated"
|
|
1833
|
+
end
|
|
1834
|
+
end
|