8000 [Notifier] Document Notifier Mercure options in README file · symfony/symfony@9c70369 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 9c70369

Browse files
committed
[Notifier] Document Notifier Mercure options in README file
1 parent 6dfbfff commit 9c70369

File tree

1 file changed

+28
-0
lines changed
  • src/Symfony/Component/Notifier/Bridge/Mercure

1 file changed

+28
-0
lines changed

src/Symfony/Component/Notifier/Bridge/Mercure/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,34 @@ where:
1414
- `HUB_ID` is the Mercure hub id
1515
- `TOPIC` is the topic IRI (optional, default: `https://symfony.com/notifier`. Could be either a single topic: `topic=https://foo` or multiple topics: `topic[]=/foo/1&topic[]=https://bar`)
1616

17+
18+
Adding Options to a Chat Message
19+
--------------------------------
20+
21+
With a Mercure Chat Message, you can use the `MercureOptions` class to add
22+
message options.
23+
24+
```php
25+
use Symfony\Component\Notifier\Message\ChatMessage;
26+
use Symfony\Component\Notifier\Bridge\Mercure\MercureOptions;
27+
28+
$chatMessage = new ChatMessage('Contribute To Symfony');
29+
30+
$options = new MercureOptions(
31+
['/topic/1', '/topic/2'],
32+
true,
33+
'id',
34+
'type',
35+
1,
36+
['tag' => '1234', 'body' => 'TEST']
37+
);
38+
39+
// Add the custom options to the chat message and send the message
40+
$chatMessage->options($options);
41+
42+
$chatter->send($chatMessage);
43+
```
44+
1745
Resources
1846
---------
1947

0 commit comments

Comments
 (0)
0