@leaflow/sdk 0.0.0-dev.439.g15ccd50 → 0.0.0-dev.441.gdbb8c45
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.
- package/dist/eventbus/v1/generated/functions.d.ts +21 -23
- package/dist/eventbus/v1/generated/functions.js +1 -2
- package/dist/eventbus/v1/generated/models.d.ts +53 -40
- package/dist/eventbus/v1/generated/schemas.zod.d.ts +25 -25
- package/dist/eventbus/v1/generated/schemas.zod.js +21 -23
- package/dist/eventbus/v1/generated/validators/createEventRequest.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/createEventRequest.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/createNamespaceRequest.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/createNamespaceRequest.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/createVersionRequest.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/createVersionRequest.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/cursorPagination.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/cursorPagination.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/error.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/error.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/errorStatus.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/errorStatus.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/eventDetail.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/eventDetail.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/eventList.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/eventList.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/eventMessage.zod.d.ts +29 -25
- package/dist/eventbus/v1/generated/validators/eventMessage.zod.js +27 -26
- package/dist/eventbus/v1/generated/validators/eventResource.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/eventResource.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/eventStatus.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/eventStatus.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/eventVersion.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/eventVersion.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/fieldViolation.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/fieldViolation.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/listEventsParams.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/listEventsParams.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/listNamespacesParams.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/listNamespacesParams.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/namespaceList.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/namespaceList.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/namespaceResource.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/namespaceResource.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/namespaceStatus.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/namespaceStatus.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/offsetPagination.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/offsetPagination.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/publication.zod.d.ts +23 -23
- package/dist/eventbus/v1/generated/validators/publication.zod.js +22 -27
- package/dist/eventbus/v1/generated/validators/publicationRecipient.zod.d.ts +89 -0
- package/dist/eventbus/v1/generated/validators/publicationRecipient.zod.js +89 -0
- package/dist/eventbus/v1/generated/validators/publishRequest.zod.d.ts +25 -24
- package/dist/eventbus/v1/generated/validators/publishRequest.zod.js +23 -23
- package/dist/eventbus/v1/generated/validators/publishResponse.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/publishResponse.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/publishedMessage.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/publishedMessage.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/realtimeTicket.zod.d.ts +20 -22
- package/dist/eventbus/v1/generated/validators/realtimeTicket.zod.js +20 -24
- package/dist/eventbus/v1/generated/validators/realtimeTicketRequest.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/realtimeTicketRequest.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/recipient.zod.d.ts +89 -0
- package/dist/eventbus/v1/generated/validators/recipient.zod.js +89 -0
- package/dist/eventbus/v1/generated/validators/sender.zod.d.ts +89 -0
- package/dist/eventbus/v1/generated/validators/sender.zod.js +92 -0
- package/dist/eventbus/v1/generated/validators/updateEventRequest.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/updateEventRequest.zod.js +20 -21
- package/dist/eventbus/v1/generated/validators/updateNamespaceRequest.zod.d.ts +20 -21
- package/dist/eventbus/v1/generated/validators/updateNamespaceRequest.zod.js +20 -21
- package/package.json +1 -1
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Leaflow Event Bus API
|
|
5
|
+
* Event definitions, versions, publishing, and realtime access.
|
|
6
|
+
*
|
|
7
|
+
* ## Definitions and messages
|
|
8
|
+
*
|
|
9
|
+
* An event is a definition: a name, a description, and one or more versions. A version carries a
|
|
10
|
+
* JSON Schema that every published payload must satisfy. Messages are not stored here and are
|
|
11
|
+
* not part of the event definition.
|
|
12
|
+
*
|
|
13
|
+
* Every event belongs to a namespace, and its name is the namespace's name, a dot, and at least a
|
|
14
|
+
* resource and an action, such as `acme.order.created`. A project creates its own namespaces and
|
|
15
|
+
* defines events in them. Platform namespaces, such as `leaflow.notification`, are maintained by
|
|
16
|
+
* platform services: their events are listed alongside the project's own and can be subscribed
|
|
17
|
+
* to, but cannot be changed or published here, and the namespaces cannot be changed or deleted.
|
|
18
|
+
* Events in a platform namespace are called platform events below.
|
|
19
|
+
*
|
|
20
|
+
* A version number never changes meaning. Adding optional properties is allowed within a version;
|
|
21
|
+
* a breaking change creates a new version. Publishing without a version uses the highest active
|
|
22
|
+
* version.
|
|
23
|
+
*
|
|
24
|
+
* ## Publishing
|
|
25
|
+
*
|
|
26
|
+
* Messages are published in batches of up to 64. A batch is validated as a whole: if any message
|
|
27
|
+
* is rejected, none is published. Publishing returns the identity of each message and does not
|
|
28
|
+
* wait for consumers. Messages are not stored and are not replayed: a consumer that connects
|
|
29
|
+
* later does not receive earlier messages.
|
|
30
|
+
*
|
|
31
|
+
* Messages published through this API are sent to the current project. A message may name a
|
|
32
|
+
* `recipient`, a member of the project; it is then sent to that member only. Without a recipient
|
|
33
|
+
* it is sent to every member of the project.
|
|
34
|
+
*
|
|
35
|
+
* Every message names its `sender`: an `id` and the `name` the publisher had when the message was
|
|
36
|
+
* accepted. A publication may also carry a `client_id`, any label the client chooses, such as one
|
|
37
|
+
* per browser tab. Receivers get it unchanged, so a client can recognise its own messages by
|
|
38
|
+
* `sender` and `client_id`. A client ID need not be unique; a realtime connection is identified
|
|
39
|
+
* by its `connection_id`.
|
|
40
|
+
*
|
|
41
|
+
* ## Realtime
|
|
42
|
+
*
|
|
43
|
+
* Every message has a topic `{event}/{recipient project_id|-}/{recipient id|-}/{key levels}`, where
|
|
44
|
+
* `-` stands for a missing recipient and the key, split at `/`, supplies the remaining levels. A topic filter
|
|
45
|
+
* uses `+` to match exactly one level and `#`, only as the last level, to match that level and
|
|
46
|
+
* every level below it, including none. For example, `{event}/{project_id}/-/#` matches every
|
|
47
|
+
* message sent to the members of a project, and `{event}/-/{user_id}/#` every message sent to one
|
|
48
|
+
* person outside any project.
|
|
49
|
+
*
|
|
50
|
+
* 1. Create a ticket with `POST /api/v1/realtime/tickets`, naming the events to receive. The
|
|
51
|
+
* response lists the topic filters the ticket covers. For a platform event they cover messages sent to the caller, messages sent to no recipient and,
|
|
52
|
+
* where the caller's permissions allow, messages sent within the project; for a project event
|
|
53
|
+
* they cover messages sent within the project. Without a selected project, use
|
|
54
|
+
* `POST /api/v1/account/realtime/tickets`; such a ticket covers only messages sent to the
|
|
55
|
+
* caller or to no recipient, and cannot publish.
|
|
56
|
+
* 2. Open a WebSocket to `wss://eventbus.leaflow.cloud/realtime` and send, within 15 seconds:
|
|
57
|
+
* `{"type":"authenticate","ticket":"…","client_id":"…"}`, where `client_id` is optional. The
|
|
58
|
+
* reply is `{"type":"authenticated","client_id":"…","connection_id":"…","expires_at":"…"}`.
|
|
59
|
+
* `connection_id` identifies this connection; it is assigned by EventBus and changes on
|
|
60
|
+
* every reconnection.
|
|
61
|
+
* 3. Only after `authenticated`, send `{"type":"subscribe","id":"…","topics":[…]}`; a
|
|
62
|
+
* subscription sent before is rejected. Each topic must be one of the returned
|
|
63
|
+
* `topics` or lie within one of them, for example by naming a key level where the ticket has
|
|
64
|
+
* `#`; a batch with any other topic is rejected as a whole. The reply is `subscribed`.
|
|
65
|
+
* `unsubscribe` takes the same form and replies `unsubscribed`.
|
|
66
|
+
* 4. Messages arrive as `{"type":"messages","messages":[…]}`, each element an `EventMessage`. A
|
|
67
|
+
* message matching several subscriptions on one connection arrives once for each of them.
|
|
68
|
+
* 5. A connection may switch to another ticket of the same user at any time by sending
|
|
69
|
+
* `authenticate` again: to renew before `expires_at`, to move from an account ticket to a
|
|
70
|
+
* project ticket, or to move to another project. Wait for its `authenticated` reply before
|
|
71
|
+
* changing subscriptions; if it is rejected, the previous ticket stays in effect. `client_id`
|
|
72
|
+
* may be omitted to keep the current one. Subscriptions the new ticket does not cover are removed at once and reported in a
|
|
73
|
+
* `{"type":"revoked","topics":[…]}` frame. A ticket for another user closes the connection
|
|
74
|
+
* with code 4401, as does letting the ticket expire.
|
|
75
|
+
*
|
|
76
|
+
* A connection holding a project ticket may publish the project's own events with
|
|
77
|
+
* `{"type":"publish","id":"…","messages":[{"event":"…","key":"…","recipient":{"id":"…"},"data":{…}}]}`;
|
|
78
|
+
* the reply is `published` with the identity of each message. `ping` is answered with `pong`.
|
|
79
|
+
* A rejected request is answered with `{"type":"error","id":"…","code":"…","message":"…"}`.
|
|
80
|
+
* Every reply carries the `id` of the request it answers.
|
|
81
|
+
* OpenAPI spec version: 1.0.0
|
|
82
|
+
*/
|
|
83
|
+
import * as zod from "zod";
|
|
84
|
+
export const publicationRecipientIdMax = 128;
|
|
85
|
+
export const PublicationRecipient = zod
|
|
86
|
+
.strictObject({
|
|
87
|
+
id: zod.string().max(publicationRecipientIdMax),
|
|
88
|
+
})
|
|
89
|
+
.describe("A member of the current project; when set, only that member receives the message");
|
|
@@ -28,69 +28,70 @@
|
|
|
28
28
|
* wait for consumers. Messages are not stored and are not replayed: a consumer that connects
|
|
29
29
|
* later does not receive earlier messages.
|
|
30
30
|
*
|
|
31
|
-
* Messages published through this API are sent to the current project. A message may name
|
|
32
|
-
* `
|
|
33
|
-
* sent to every member of the project.
|
|
31
|
+
* Messages published through this API are sent to the current project. A message may name a
|
|
32
|
+
* `recipient`, a member of the project; it is then sent to that member only. Without a recipient
|
|
33
|
+
* it is sent to every member of the project.
|
|
34
34
|
*
|
|
35
|
-
* Every
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
35
|
+
* Every message names its `sender`: an `id` and the `name` the publisher had when the message was
|
|
36
|
+
* accepted. A publication may also carry a `client_id`, any label the client chooses, such as one
|
|
37
|
+
* per browser tab. Receivers get it unchanged, so a client can recognise its own messages by
|
|
38
|
+
* `sender` and `client_id`. A client ID need not be unique; a realtime connection is identified
|
|
39
|
+
* by its `connection_id`.
|
|
40
40
|
*
|
|
41
41
|
* ## Realtime
|
|
42
42
|
*
|
|
43
|
-
* Every message has a topic `{event}/{project_id|-}/{
|
|
44
|
-
* for a missing recipient and the key, split at `/`, supplies the remaining levels. A topic filter
|
|
43
|
+
* Every message has a topic `{event}/{recipient project_id|-}/{recipient id|-}/{key levels}`, where
|
|
44
|
+
* `-` stands for a missing recipient and the key, split at `/`, supplies the remaining levels. A topic filter
|
|
45
45
|
* uses `+` to match exactly one level and `#`, only as the last level, to match that level and
|
|
46
46
|
* every level below it, including none. For example, `{event}/{project_id}/-/#` matches every
|
|
47
47
|
* message sent to the members of a project, and `{event}/-/{user_id}/#` every message sent to one
|
|
48
48
|
* person outside any project.
|
|
49
49
|
*
|
|
50
50
|
* 1. Create a ticket with `POST /api/v1/realtime/tickets`, naming the events to receive. The
|
|
51
|
-
* response lists the topic filters the ticket covers
|
|
52
|
-
* platform event they cover messages sent to the caller, messages sent to no recipient and,
|
|
51
|
+
* response lists the topic filters the ticket covers. For a platform event they cover messages sent to the caller, messages sent to no recipient and,
|
|
53
52
|
* where the caller's permissions allow, messages sent within the project; for a project event
|
|
54
53
|
* they cover messages sent within the project. Without a selected project, use
|
|
55
54
|
* `POST /api/v1/account/realtime/tickets`; such a ticket covers only messages sent to the
|
|
56
55
|
* caller or to no recipient, and cannot publish.
|
|
57
56
|
* 2. Open a WebSocket to `wss://eventbus.leaflow.cloud/realtime` and send, within 15 seconds:
|
|
58
|
-
* `{"type":"authenticate","ticket":"…","client_id":"…"}
|
|
59
|
-
* `{"type":"authenticated","client_id":"…","connection_id":"…","expires_at":"…"}`.
|
|
57
|
+
* `{"type":"authenticate","ticket":"…","client_id":"…"}`, where `client_id` is optional. The
|
|
58
|
+
* reply is `{"type":"authenticated","client_id":"…","connection_id":"…","expires_at":"…"}`.
|
|
60
59
|
* `connection_id` identifies this connection; it is assigned by EventBus and changes on
|
|
61
60
|
* every reconnection.
|
|
62
|
-
* 3.
|
|
61
|
+
* 3. Only after `authenticated`, send `{"type":"subscribe","id":"…","topics":[…]}`; a
|
|
62
|
+
* subscription sent before is rejected. Each topic must be one of the returned
|
|
63
63
|
* `topics` or lie within one of them, for example by naming a key level where the ticket has
|
|
64
64
|
* `#`; a batch with any other topic is rejected as a whole. The reply is `subscribed`.
|
|
65
|
-
* `unsubscribe` takes the same form and replies `unsubscribed`.
|
|
66
|
-
* while the connection is open.
|
|
65
|
+
* `unsubscribe` takes the same form and replies `unsubscribed`.
|
|
67
66
|
* 4. Messages arrive as `{"type":"messages","messages":[…]}`, each element an `EventMessage`. A
|
|
68
67
|
* message matching several subscriptions on one connection arrives once for each of them.
|
|
69
68
|
* 5. A connection may switch to another ticket of the same user at any time by sending
|
|
70
69
|
* `authenticate` again: to renew before `expires_at`, to move from an account ticket to a
|
|
71
|
-
* project ticket, or to move to another project.
|
|
72
|
-
*
|
|
73
|
-
*
|
|
70
|
+
* project ticket, or to move to another project. Wait for its `authenticated` reply before
|
|
71
|
+
* changing subscriptions; if it is rejected, the previous ticket stays in effect. `client_id`
|
|
72
|
+
* may be omitted to keep the current one. Subscriptions the new ticket does not cover are removed at once and reported in a
|
|
74
73
|
* `{"type":"revoked","topics":[…]}` frame. A ticket for another user closes the connection
|
|
75
74
|
* with code 4401, as does letting the ticket expire.
|
|
76
75
|
*
|
|
77
76
|
* A connection holding a project ticket may publish the project's own events with
|
|
78
|
-
* `{"type":"publish","id":"…","messages":[{"event":"…","key":"…","
|
|
77
|
+
* `{"type":"publish","id":"…","messages":[{"event":"…","key":"…","recipient":{"id":"…"},"data":{…}}]}`;
|
|
79
78
|
* the reply is `published` with the identity of each message. `ping` is answered with `pong`.
|
|
80
79
|
* A rejected request is answered with `{"type":"error","id":"…","code":"…","message":"…"}`.
|
|
81
80
|
* Every reply carries the `id` of the request it answers.
|
|
82
81
|
* OpenAPI spec version: 1.0.0
|
|
83
82
|
*/
|
|
84
83
|
import * as zod from "zod";
|
|
85
|
-
export declare const publishRequestClientIdMax =
|
|
84
|
+
export declare const publishRequestClientIdMax = 128;
|
|
86
85
|
export declare const publishRequestMessagesMax = 64;
|
|
87
86
|
export declare const PublishRequest: zod.ZodObject<{
|
|
88
|
-
client_id: zod.ZodString
|
|
87
|
+
client_id: zod.ZodOptional<zod.ZodString>;
|
|
89
88
|
messages: zod.ZodArray<zod.ZodObject<{
|
|
90
89
|
event: zod.ZodString;
|
|
91
90
|
version: zod.ZodDefault<zod.ZodInt>;
|
|
92
91
|
key: zod.ZodOptional<zod.ZodString>;
|
|
93
|
-
|
|
92
|
+
recipient: zod.ZodOptional<zod.ZodObject<{
|
|
93
|
+
id: zod.ZodString;
|
|
94
|
+
}, zod.z.core.$strict>>;
|
|
94
95
|
data: zod.ZodRecord<zod.ZodString, zod.ZodUnknown>;
|
|
95
96
|
}, zod.z.core.$strict>>;
|
|
96
97
|
}, zod.z.core.$strict>;
|
|
@@ -28,54 +28,53 @@
|
|
|
28
28
|
* wait for consumers. Messages are not stored and are not replayed: a consumer that connects
|
|
29
29
|
* later does not receive earlier messages.
|
|
30
30
|
*
|
|
31
|
-
* Messages published through this API are sent to the current project. A message may name
|
|
32
|
-
* `
|
|
33
|
-
* sent to every member of the project.
|
|
31
|
+
* Messages published through this API are sent to the current project. A message may name a
|
|
32
|
+
* `recipient`, a member of the project; it is then sent to that member only. Without a recipient
|
|
33
|
+
* it is sent to every member of the project.
|
|
34
34
|
*
|
|
35
|
-
* Every
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
35
|
+
* Every message names its `sender`: an `id` and the `name` the publisher had when the message was
|
|
36
|
+
* accepted. A publication may also carry a `client_id`, any label the client chooses, such as one
|
|
37
|
+
* per browser tab. Receivers get it unchanged, so a client can recognise its own messages by
|
|
38
|
+
* `sender` and `client_id`. A client ID need not be unique; a realtime connection is identified
|
|
39
|
+
* by its `connection_id`.
|
|
40
40
|
*
|
|
41
41
|
* ## Realtime
|
|
42
42
|
*
|
|
43
|
-
* Every message has a topic `{event}/{project_id|-}/{
|
|
44
|
-
* for a missing recipient and the key, split at `/`, supplies the remaining levels. A topic filter
|
|
43
|
+
* Every message has a topic `{event}/{recipient project_id|-}/{recipient id|-}/{key levels}`, where
|
|
44
|
+
* `-` stands for a missing recipient and the key, split at `/`, supplies the remaining levels. A topic filter
|
|
45
45
|
* uses `+` to match exactly one level and `#`, only as the last level, to match that level and
|
|
46
46
|
* every level below it, including none. For example, `{event}/{project_id}/-/#` matches every
|
|
47
47
|
* message sent to the members of a project, and `{event}/-/{user_id}/#` every message sent to one
|
|
48
48
|
* person outside any project.
|
|
49
49
|
*
|
|
50
50
|
* 1. Create a ticket with `POST /api/v1/realtime/tickets`, naming the events to receive. The
|
|
51
|
-
* response lists the topic filters the ticket covers
|
|
52
|
-
* platform event they cover messages sent to the caller, messages sent to no recipient and,
|
|
51
|
+
* response lists the topic filters the ticket covers. For a platform event they cover messages sent to the caller, messages sent to no recipient and,
|
|
53
52
|
* where the caller's permissions allow, messages sent within the project; for a project event
|
|
54
53
|
* they cover messages sent within the project. Without a selected project, use
|
|
55
54
|
* `POST /api/v1/account/realtime/tickets`; such a ticket covers only messages sent to the
|
|
56
55
|
* caller or to no recipient, and cannot publish.
|
|
57
56
|
* 2. Open a WebSocket to `wss://eventbus.leaflow.cloud/realtime` and send, within 15 seconds:
|
|
58
|
-
* `{"type":"authenticate","ticket":"…","client_id":"…"}
|
|
59
|
-
* `{"type":"authenticated","client_id":"…","connection_id":"…","expires_at":"…"}`.
|
|
57
|
+
* `{"type":"authenticate","ticket":"…","client_id":"…"}`, where `client_id` is optional. The
|
|
58
|
+
* reply is `{"type":"authenticated","client_id":"…","connection_id":"…","expires_at":"…"}`.
|
|
60
59
|
* `connection_id` identifies this connection; it is assigned by EventBus and changes on
|
|
61
60
|
* every reconnection.
|
|
62
|
-
* 3.
|
|
61
|
+
* 3. Only after `authenticated`, send `{"type":"subscribe","id":"…","topics":[…]}`; a
|
|
62
|
+
* subscription sent before is rejected. Each topic must be one of the returned
|
|
63
63
|
* `topics` or lie within one of them, for example by naming a key level where the ticket has
|
|
64
64
|
* `#`; a batch with any other topic is rejected as a whole. The reply is `subscribed`.
|
|
65
|
-
* `unsubscribe` takes the same form and replies `unsubscribed`.
|
|
66
|
-
* while the connection is open.
|
|
65
|
+
* `unsubscribe` takes the same form and replies `unsubscribed`.
|
|
67
66
|
* 4. Messages arrive as `{"type":"messages","messages":[…]}`, each element an `EventMessage`. A
|
|
68
67
|
* message matching several subscriptions on one connection arrives once for each of them.
|
|
69
68
|
* 5. A connection may switch to another ticket of the same user at any time by sending
|
|
70
69
|
* `authenticate` again: to renew before `expires_at`, to move from an account ticket to a
|
|
71
|
-
* project ticket, or to move to another project.
|
|
72
|
-
*
|
|
73
|
-
*
|
|
70
|
+
* project ticket, or to move to another project. Wait for its `authenticated` reply before
|
|
71
|
+
* changing subscriptions; if it is rejected, the previous ticket stays in effect. `client_id`
|
|
72
|
+
* may be omitted to keep the current one. Subscriptions the new ticket does not cover are removed at once and reported in a
|
|
74
73
|
* `{"type":"revoked","topics":[…]}` frame. A ticket for another user closes the connection
|
|
75
74
|
* with code 4401, as does letting the ticket expire.
|
|
76
75
|
*
|
|
77
76
|
* A connection holding a project ticket may publish the project's own events with
|
|
78
|
-
* `{"type":"publish","id":"…","messages":[{"event":"…","key":"…","
|
|
77
|
+
* `{"type":"publish","id":"…","messages":[{"event":"…","key":"…","recipient":{"id":"…"},"data":{…}}]}`;
|
|
79
78
|
* the reply is `published` with the identity of each message. `ping` is answered with `pong`.
|
|
80
79
|
* A rejected request is answered with `{"type":"error","id":"…","code":"…","message":"…"}`.
|
|
81
80
|
* Every reply carries the `id` of the request it answers.
|
|
@@ -83,12 +82,13 @@
|
|
|
83
82
|
*/
|
|
84
83
|
import * as zod from "zod";
|
|
85
84
|
import { Publication } from "./publication.zod.js";
|
|
86
|
-
export const publishRequestClientIdMax =
|
|
85
|
+
export const publishRequestClientIdMax = 128;
|
|
87
86
|
export const publishRequestMessagesMax = 64;
|
|
88
87
|
export const PublishRequest = zod.strictObject({
|
|
89
88
|
client_id: zod
|
|
90
89
|
.string()
|
|
91
90
|
.max(publishRequestClientIdMax)
|
|
92
|
-
.
|
|
91
|
+
.optional()
|
|
92
|
+
.describe("Any label for the publishing client, such as one per browser tab; it need not be unique"),
|
|
93
93
|
messages: zod.array(Publication).min(1).max(publishRequestMessagesMax),
|
|
94
94
|
});
|
|
@@ -28,54 +28,53 @@
|
|
|
28
28
|
* wait for consumers. Messages are not stored and are not replayed: a consumer that connects
|
|
29
29
|
* later does not receive earlier messages.
|
|
30
30
|
*
|
|
31
|
-
* Messages published through this API are sent to the current project. A message may name
|
|
32
|
-
* `
|
|
33
|
-
* sent to every member of the project.
|
|
31
|
+
* Messages published through this API are sent to the current project. A message may name a
|
|
32
|
+
* `recipient`, a member of the project; it is then sent to that member only. Without a recipient
|
|
33
|
+
* it is sent to every member of the project.
|
|
34
34
|
*
|
|
35
|
-
* Every
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
35
|
+
* Every message names its `sender`: an `id` and the `name` the publisher had when the message was
|
|
36
|
+
* accepted. A publication may also carry a `client_id`, any label the client chooses, such as one
|
|
37
|
+
* per browser tab. Receivers get it unchanged, so a client can recognise its own messages by
|
|
38
|
+
* `sender` and `client_id`. A client ID need not be unique; a realtime connection is identified
|
|
39
|
+
* by its `connection_id`.
|
|
40
40
|
*
|
|
41
41
|
* ## Realtime
|
|
42
42
|
*
|
|
43
|
-
* Every message has a topic `{event}/{project_id|-}/{
|
|
44
|
-
* for a missing recipient and the key, split at `/`, supplies the remaining levels. A topic filter
|
|
43
|
+
* Every message has a topic `{event}/{recipient project_id|-}/{recipient id|-}/{key levels}`, where
|
|
44
|
+
* `-` stands for a missing recipient and the key, split at `/`, supplies the remaining levels. A topic filter
|
|
45
45
|
* uses `+` to match exactly one level and `#`, only as the last level, to match that level and
|
|
46
46
|
* every level below it, including none. For example, `{event}/{project_id}/-/#` matches every
|
|
47
47
|
* message sent to the members of a project, and `{event}/-/{user_id}/#` every message sent to one
|
|
48
48
|
* person outside any project.
|
|
49
49
|
*
|
|
50
50
|
* 1. Create a ticket with `POST /api/v1/realtime/tickets`, naming the events to receive. The
|
|
51
|
-
* response lists the topic filters the ticket covers
|
|
52
|
-
* platform event they cover messages sent to the caller, messages sent to no recipient and,
|
|
51
|
+
* response lists the topic filters the ticket covers. For a platform event they cover messages sent to the caller, messages sent to no recipient and,
|
|
53
52
|
* where the caller's permissions allow, messages sent within the project; for a project event
|
|
54
53
|
* they cover messages sent within the project. Without a selected project, use
|
|
55
54
|
* `POST /api/v1/account/realtime/tickets`; such a ticket covers only messages sent to the
|
|
56
55
|
* caller or to no recipient, and cannot publish.
|
|
57
56
|
* 2. Open a WebSocket to `wss://eventbus.leaflow.cloud/realtime` and send, within 15 seconds:
|
|
58
|
-
* `{"type":"authenticate","ticket":"…","client_id":"…"}
|
|
59
|
-
* `{"type":"authenticated","client_id":"…","connection_id":"…","expires_at":"…"}`.
|
|
57
|
+
* `{"type":"authenticate","ticket":"…","client_id":"…"}`, where `client_id` is optional. The
|
|
58
|
+
* reply is `{"type":"authenticated","client_id":"…","connection_id":"…","expires_at":"…"}`.
|
|
60
59
|
* `connection_id` identifies this connection; it is assigned by EventBus and changes on
|
|
61
60
|
* every reconnection.
|
|
62
|
-
* 3.
|
|
61
|
+
* 3. Only after `authenticated`, send `{"type":"subscribe","id":"…","topics":[…]}`; a
|
|
62
|
+
* subscription sent before is rejected. Each topic must be one of the returned
|
|
63
63
|
* `topics` or lie within one of them, for example by naming a key level where the ticket has
|
|
64
64
|
* `#`; a batch with any other topic is rejected as a whole. The reply is `subscribed`.
|
|
65
|
-
* `unsubscribe` takes the same form and replies `unsubscribed`.
|
|
66
|
-
* while the connection is open.
|
|
65
|
+
* `unsubscribe` takes the same form and replies `unsubscribed`.
|
|
67
66
|
* 4. Messages arrive as `{"type":"messages","messages":[…]}`, each element an `EventMessage`. A
|
|
68
67
|
* message matching several subscriptions on one connection arrives once for each of them.
|
|
69
68
|
* 5. A connection may switch to another ticket of the same user at any time by sending
|
|
70
69
|
* `authenticate` again: to renew before `expires_at`, to move from an account ticket to a
|
|
71
|
-
* project ticket, or to move to another project.
|
|
72
|
-
*
|
|
73
|
-
*
|
|
70
|
+
* project ticket, or to move to another project. Wait for its `authenticated` reply before
|
|
71
|
+
* changing subscriptions; if it is rejected, the previous ticket stays in effect. `client_id`
|
|
72
|
+
* may be omitted to keep the current one. Subscriptions the new ticket does not cover are removed at once and reported in a
|
|
74
73
|
* `{"type":"revoked","topics":[…]}` frame. A ticket for another user closes the connection
|
|
75
74
|
* with code 4401, as does letting the ticket expire.
|
|
76
75
|
*
|
|
77
76
|
* A connection holding a project ticket may publish the project's own events with
|
|
78
|
-
* `{"type":"publish","id":"…","messages":[{"event":"…","key":"…","
|
|
77
|
+
* `{"type":"publish","id":"…","messages":[{"event":"…","key":"…","recipient":{"id":"…"},"data":{…}}]}`;
|
|
79
78
|
* the reply is `published` with the identity of each message. `ping` is answered with `pong`.
|
|
80
79
|
* A rejected request is answered with `{"type":"error","id":"…","code":"…","message":"…"}`.
|
|
81
80
|
* Every reply carries the `id` of the request it answers.
|
|
@@ -28,54 +28,53 @@
|
|
|
28
28
|
* wait for consumers. Messages are not stored and are not replayed: a consumer that connects
|
|
29
29
|
* later does not receive earlier messages.
|
|
30
30
|
*
|
|
31
|
-
* Messages published through this API are sent to the current project. A message may name
|
|
32
|
-
* `
|
|
33
|
-
* sent to every member of the project.
|
|
31
|
+
* Messages published through this API are sent to the current project. A message may name a
|
|
32
|
+
* `recipient`, a member of the project; it is then sent to that member only. Without a recipient
|
|
33
|
+
* it is sent to every member of the project.
|
|
34
34
|
*
|
|
35
|
-
* Every
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
35
|
+
* Every message names its `sender`: an `id` and the `name` the publisher had when the message was
|
|
36
|
+
* accepted. A publication may also carry a `client_id`, any label the client chooses, such as one
|
|
37
|
+
* per browser tab. Receivers get it unchanged, so a client can recognise its own messages by
|
|
38
|
+
* `sender` and `client_id`. A client ID need not be unique; a realtime connection is identified
|
|
39
|
+
* by its `connection_id`.
|
|
40
40
|
*
|
|
41
41
|
* ## Realtime
|
|
42
42
|
*
|
|
43
|
-
* Every message has a topic `{event}/{project_id|-}/{
|
|
44
|
-
* for a missing recipient and the key, split at `/`, supplies the remaining levels. A topic filter
|
|
43
|
+
* Every message has a topic `{event}/{recipient project_id|-}/{recipient id|-}/{key levels}`, where
|
|
44
|
+
* `-` stands for a missing recipient and the key, split at `/`, supplies the remaining levels. A topic filter
|
|
45
45
|
* uses `+` to match exactly one level and `#`, only as the last level, to match that level and
|
|
46
46
|
* every level below it, including none. For example, `{event}/{project_id}/-/#` matches every
|
|
47
47
|
* message sent to the members of a project, and `{event}/-/{user_id}/#` every message sent to one
|
|
48
48
|
* person outside any project.
|
|
49
49
|
*
|
|
50
50
|
* 1. Create a ticket with `POST /api/v1/realtime/tickets`, naming the events to receive. The
|
|
51
|
-
* response lists the topic filters the ticket covers
|
|
52
|
-
* platform event they cover messages sent to the caller, messages sent to no recipient and,
|
|
51
|
+
* response lists the topic filters the ticket covers. For a platform event they cover messages sent to the caller, messages sent to no recipient and,
|
|
53
52
|
* where the caller's permissions allow, messages sent within the project; for a project event
|
|
54
53
|
* they cover messages sent within the project. Without a selected project, use
|
|
55
54
|
* `POST /api/v1/account/realtime/tickets`; such a ticket covers only messages sent to the
|
|
56
55
|
* caller or to no recipient, and cannot publish.
|
|
57
56
|
* 2. Open a WebSocket to `wss://eventbus.leaflow.cloud/realtime` and send, within 15 seconds:
|
|
58
|
-
* `{"type":"authenticate","ticket":"…","client_id":"…"}
|
|
59
|
-
* `{"type":"authenticated","client_id":"…","connection_id":"…","expires_at":"…"}`.
|
|
57
|
+
* `{"type":"authenticate","ticket":"…","client_id":"…"}`, where `client_id` is optional. The
|
|
58
|
+
* reply is `{"type":"authenticated","client_id":"…","connection_id":"…","expires_at":"…"}`.
|
|
60
59
|
* `connection_id` identifies this connection; it is assigned by EventBus and changes on
|
|
61
60
|
* every reconnection.
|
|
62
|
-
* 3.
|
|
61
|
+
* 3. Only after `authenticated`, send `{"type":"subscribe","id":"…","topics":[…]}`; a
|
|
62
|
+
* subscription sent before is rejected. Each topic must be one of the returned
|
|
63
63
|
* `topics` or lie within one of them, for example by naming a key level where the ticket has
|
|
64
64
|
* `#`; a batch with any other topic is rejected as a whole. The reply is `subscribed`.
|
|
65
|
-
* `unsubscribe` takes the same form and replies `unsubscribed`.
|
|
66
|
-
* while the connection is open.
|
|
65
|
+
* `unsubscribe` takes the same form and replies `unsubscribed`.
|
|
67
66
|
* 4. Messages arrive as `{"type":"messages","messages":[…]}`, each element an `EventMessage`. A
|
|
68
67
|
* message matching several subscriptions on one connection arrives once for each of them.
|
|
69
68
|
* 5. A connection may switch to another ticket of the same user at any time by sending
|
|
70
69
|
* `authenticate` again: to renew before `expires_at`, to move from an account ticket to a
|
|
71
|
-
* project ticket, or to move to another project.
|
|
72
|
-
*
|
|
73
|
-
*
|
|
70
|
+
* project ticket, or to move to another project. Wait for its `authenticated` reply before
|
|
71
|
+
* changing subscriptions; if it is rejected, the previous ticket stays in effect. `client_id`
|
|
72
|
+
* may be omitted to keep the current one. Subscriptions the new ticket does not cover are removed at once and reported in a
|
|
74
73
|
* `{"type":"revoked","topics":[…]}` frame. A ticket for another user closes the connection
|
|
75
74
|
* with code 4401, as does letting the ticket expire.
|
|
76
75
|
*
|
|
77
76
|
* A connection holding a project ticket may publish the project's own events with
|
|
78
|
-
* `{"type":"publish","id":"…","messages":[{"event":"…","key":"…","
|
|
77
|
+
* `{"type":"publish","id":"…","messages":[{"event":"…","key":"…","recipient":{"id":"…"},"data":{…}}]}`;
|
|
79
78
|
* the reply is `published` with the identity of each message. `ping` is answered with `pong`.
|
|
80
79
|
* A rejected request is answered with `{"type":"error","id":"…","code":"…","message":"…"}`.
|
|
81
80
|
* Every reply carries the `id` of the request it answers.
|
|
@@ -28,54 +28,53 @@
|
|
|
28
28
|
* wait for consumers. Messages are not stored and are not replayed: a consumer that connects
|
|
29
29
|
* later does not receive earlier messages.
|
|
30
30
|
*
|
|
31
|
-
* Messages published through this API are sent to the current project. A message may name
|
|
32
|
-
* `
|
|
33
|
-
* sent to every member of the project.
|
|
31
|
+
* Messages published through this API are sent to the current project. A message may name a
|
|
32
|
+
* `recipient`, a member of the project; it is then sent to that member only. Without a recipient
|
|
33
|
+
* it is sent to every member of the project.
|
|
34
34
|
*
|
|
35
|
-
* Every
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
35
|
+
* Every message names its `sender`: an `id` and the `name` the publisher had when the message was
|
|
36
|
+
* accepted. A publication may also carry a `client_id`, any label the client chooses, such as one
|
|
37
|
+
* per browser tab. Receivers get it unchanged, so a client can recognise its own messages by
|
|
38
|
+
* `sender` and `client_id`. A client ID need not be unique; a realtime connection is identified
|
|
39
|
+
* by its `connection_id`.
|
|
40
40
|
*
|
|
41
41
|
* ## Realtime
|
|
42
42
|
*
|
|
43
|
-
* Every message has a topic `{event}/{project_id|-}/{
|
|
44
|
-
* for a missing recipient and the key, split at `/`, supplies the remaining levels. A topic filter
|
|
43
|
+
* Every message has a topic `{event}/{recipient project_id|-}/{recipient id|-}/{key levels}`, where
|
|
44
|
+
* `-` stands for a missing recipient and the key, split at `/`, supplies the remaining levels. A topic filter
|
|
45
45
|
* uses `+` to match exactly one level and `#`, only as the last level, to match that level and
|
|
46
46
|
* every level below it, including none. For example, `{event}/{project_id}/-/#` matches every
|
|
47
47
|
* message sent to the members of a project, and `{event}/-/{user_id}/#` every message sent to one
|
|
48
48
|
* person outside any project.
|
|
49
49
|
*
|
|
50
50
|
* 1. Create a ticket with `POST /api/v1/realtime/tickets`, naming the events to receive. The
|
|
51
|
-
* response lists the topic filters the ticket covers
|
|
52
|
-
* platform event they cover messages sent to the caller, messages sent to no recipient and,
|
|
51
|
+
* response lists the topic filters the ticket covers. For a platform event they cover messages sent to the caller, messages sent to no recipient and,
|
|
53
52
|
* where the caller's permissions allow, messages sent within the project; for a project event
|
|
54
53
|
* they cover messages sent within the project. Without a selected project, use
|
|
55
54
|
* `POST /api/v1/account/realtime/tickets`; such a ticket covers only messages sent to the
|
|
56
55
|
* caller or to no recipient, and cannot publish.
|
|
57
56
|
* 2. Open a WebSocket to `wss://eventbus.leaflow.cloud/realtime` and send, within 15 seconds:
|
|
58
|
-
* `{"type":"authenticate","ticket":"…","client_id":"…"}
|
|
59
|
-
* `{"type":"authenticated","client_id":"…","connection_id":"…","expires_at":"…"}`.
|
|
57
|
+
* `{"type":"authenticate","ticket":"…","client_id":"…"}`, where `client_id` is optional. The
|
|
58
|
+
* reply is `{"type":"authenticated","client_id":"…","connection_id":"…","expires_at":"…"}`.
|
|
60
59
|
* `connection_id` identifies this connection; it is assigned by EventBus and changes on
|
|
61
60
|
* every reconnection.
|
|
62
|
-
* 3.
|
|
61
|
+
* 3. Only after `authenticated`, send `{"type":"subscribe","id":"…","topics":[…]}`; a
|
|
62
|
+
* subscription sent before is rejected. Each topic must be one of the returned
|
|
63
63
|
* `topics` or lie within one of them, for example by naming a key level where the ticket has
|
|
64
64
|
* `#`; a batch with any other topic is rejected as a whole. The reply is `subscribed`.
|
|
65
|
-
* `unsubscribe` takes the same form and replies `unsubscribed`.
|
|
66
|
-
* while the connection is open.
|
|
65
|
+
* `unsubscribe` takes the same form and replies `unsubscribed`.
|
|
67
66
|
* 4. Messages arrive as `{"type":"messages","messages":[…]}`, each element an `EventMessage`. A
|
|
68
67
|
* message matching several subscriptions on one connection arrives once for each of them.
|
|
69
68
|
* 5. A connection may switch to another ticket of the same user at any time by sending
|
|
70
69
|
* `authenticate` again: to renew before `expires_at`, to move from an account ticket to a
|
|
71
|
-
* project ticket, or to move to another project.
|
|
72
|
-
*
|
|
73
|
-
*
|
|
70
|
+
* project ticket, or to move to another project. Wait for its `authenticated` reply before
|
|
71
|
+
* changing subscriptions; if it is rejected, the previous ticket stays in effect. `client_id`
|
|
72
|
+
* may be omitted to keep the current one. Subscriptions the new ticket does not cover are removed at once and reported in a
|
|
74
73
|
* `{"type":"revoked","topics":[…]}` frame. A ticket for another user closes the connection
|
|
75
74
|
* with code 4401, as does letting the ticket expire.
|
|
76
75
|
*
|
|
77
76
|
* A connection holding a project ticket may publish the project's own events with
|
|
78
|
-
* `{"type":"publish","id":"…","messages":[{"event":"…","key":"…","
|
|
77
|
+
* `{"type":"publish","id":"…","messages":[{"event":"…","key":"…","recipient":{"id":"…"},"data":{…}}]}`;
|
|
79
78
|
* the reply is `published` with the identity of each message. `ping` is answered with `pong`.
|
|
80
79
|
* A rejected request is answered with `{"type":"error","id":"…","code":"…","message":"…"}`.
|
|
81
80
|
* Every reply carries the `id` of the request it answers.
|
|
@@ -28,54 +28,53 @@
|
|
|
28
28
|
* wait for consumers. Messages are not stored and are not replayed: a consumer that connects
|
|
29
29
|
* later does not receive earlier messages.
|
|
30
30
|
*
|
|
31
|
-
* Messages published through this API are sent to the current project. A message may name
|
|
32
|
-
* `
|
|
33
|
-
* sent to every member of the project.
|
|
31
|
+
* Messages published through this API are sent to the current project. A message may name a
|
|
32
|
+
* `recipient`, a member of the project; it is then sent to that member only. Without a recipient
|
|
33
|
+
* it is sent to every member of the project.
|
|
34
34
|
*
|
|
35
|
-
* Every
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
35
|
+
* Every message names its `sender`: an `id` and the `name` the publisher had when the message was
|
|
36
|
+
* accepted. A publication may also carry a `client_id`, any label the client chooses, such as one
|
|
37
|
+
* per browser tab. Receivers get it unchanged, so a client can recognise its own messages by
|
|
38
|
+
* `sender` and `client_id`. A client ID need not be unique; a realtime connection is identified
|
|
39
|
+
* by its `connection_id`.
|
|
40
40
|
*
|
|
41
41
|
* ## Realtime
|
|
42
42
|
*
|
|
43
|
-
* Every message has a topic `{event}/{project_id|-}/{
|
|
44
|
-
* for a missing recipient and the key, split at `/`, supplies the remaining levels. A topic filter
|
|
43
|
+
* Every message has a topic `{event}/{recipient project_id|-}/{recipient id|-}/{key levels}`, where
|
|
44
|
+
* `-` stands for a missing recipient and the key, split at `/`, supplies the remaining levels. A topic filter
|
|
45
45
|
* uses `+` to match exactly one level and `#`, only as the last level, to match that level and
|
|
46
46
|
* every level below it, including none. For example, `{event}/{project_id}/-/#` matches every
|
|
47
47
|
* message sent to the members of a project, and `{event}/-/{user_id}/#` every message sent to one
|
|
48
48
|
* person outside any project.
|
|
49
49
|
*
|
|
50
50
|
* 1. Create a ticket with `POST /api/v1/realtime/tickets`, naming the events to receive. The
|
|
51
|
-
* response lists the topic filters the ticket covers
|
|
52
|
-
* platform event they cover messages sent to the caller, messages sent to no recipient and,
|
|
51
|
+
* response lists the topic filters the ticket covers. For a platform event they cover messages sent to the caller, messages sent to no recipient and,
|
|
53
52
|
* where the caller's permissions allow, messages sent within the project; for a project event
|
|
54
53
|
* they cover messages sent within the project. Without a selected project, use
|
|
55
54
|
* `POST /api/v1/account/realtime/tickets`; such a ticket covers only messages sent to the
|
|
56
55
|
* caller or to no recipient, and cannot publish.
|
|
57
56
|
* 2. Open a WebSocket to `wss://eventbus.leaflow.cloud/realtime` and send, within 15 seconds:
|
|
58
|
-
* `{"type":"authenticate","ticket":"…","client_id":"…"}
|
|
59
|
-
* `{"type":"authenticated","client_id":"…","connection_id":"…","expires_at":"…"}`.
|
|
57
|
+
* `{"type":"authenticate","ticket":"…","client_id":"…"}`, where `client_id` is optional. The
|
|
58
|
+
* reply is `{"type":"authenticated","client_id":"…","connection_id":"…","expires_at":"…"}`.
|
|
60
59
|
* `connection_id` identifies this connection; it is assigned by EventBus and changes on
|
|
61
60
|
* every reconnection.
|
|
62
|
-
* 3.
|
|
61
|
+
* 3. Only after `authenticated`, send `{"type":"subscribe","id":"…","topics":[…]}`; a
|
|
62
|
+
* subscription sent before is rejected. Each topic must be one of the returned
|
|
63
63
|
* `topics` or lie within one of them, for example by naming a key level where the ticket has
|
|
64
64
|
* `#`; a batch with any other topic is rejected as a whole. The reply is `subscribed`.
|
|
65
|
-
* `unsubscribe` takes the same form and replies `unsubscribed`.
|
|
66
|
-
* while the connection is open.
|
|
65
|
+
* `unsubscribe` takes the same form and replies `unsubscribed`.
|
|
67
66
|
* 4. Messages arrive as `{"type":"messages","messages":[…]}`, each element an `EventMessage`. A
|
|
68
67
|
* message matching several subscriptions on one connection arrives once for each of them.
|
|
69
68
|
* 5. A connection may switch to another ticket of the same user at any time by sending
|
|
70
69
|
* `authenticate` again: to renew before `expires_at`, to move from an account ticket to a
|
|
71
|
-
* project ticket, or to move to another project.
|
|
72
|
-
*
|
|
73
|
-
*
|
|
70
|
+
* project ticket, or to move to another project. Wait for its `authenticated` reply before
|
|
71
|
+
* changing subscriptions; if it is rejected, the previous ticket stays in effect. `client_id`
|
|
72
|
+
* may be omitted to keep the current one. Subscriptions the new ticket does not cover are removed at once and reported in a
|
|
74
73
|
* `{"type":"revoked","topics":[…]}` frame. A ticket for another user closes the connection
|
|
75
74
|
* with code 4401, as does letting the ticket expire.
|
|
76
75
|
*
|
|
77
76
|
* A connection holding a project ticket may publish the project's own events with
|
|
78
|
-
* `{"type":"publish","id":"…","messages":[{"event":"…","key":"…","
|
|
77
|
+
* `{"type":"publish","id":"…","messages":[{"event":"…","key":"…","recipient":{"id":"…"},"data":{…}}]}`;
|
|
79
78
|
* the reply is `published` with the identity of each message. `ping` is answered with `pong`.
|
|
80
79
|
* A rejected request is answered with `{"type":"error","id":"…","code":"…","message":"…"}`.
|
|
81
80
|
* Every reply carries the `id` of the request it answers.
|