feat: add type definition to signal recipients

follows more the notifications way of setting recipients and is more
future proof

Signed-off-by: Heikki Hellgren <heikki.hellgren@op.fi>
This commit is contained in:
Heikki Hellgren
2024-03-13 13:10:55 +02:00
parent b76d0cd4f9
commit 6c1547a4fb
9 changed files with 41 additions and 18 deletions
+3 -3
View File
@@ -91,13 +91,13 @@ To allow connections from the frontend, you should also install the `@backstage/
Once you have both of the backend plugins installed, you can utilize the signal service by calling the
`publish` method. This will publish the message to all subscribers in the frontend. To send message to
all subscribers, you can use `null` as `recipients` parameter.
all subscribers, you can use `broadcast` type:
```ts
// Periodic sending example
setInterval(async () => {
await signals.publish({
recipients: null,
recipients: { type: 'broadcast' },
channel: 'my_plugin',
message: {
message: 'hello world',
@@ -118,7 +118,7 @@ to work:
eventBroker.publish({
topic: 'signals',
eventPayload: {
recipients: ['user:default/user1'],
recipients: { type: 'user', entityRefs: ['user:default/user1'] },
message: {
message: 'hello world',
},