Skip to content

[Notifier] Document Notifier Mercure options in README file #60259

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 7.3
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/Symfony/Component/Notifier/Bridge/Mercure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,34 @@ where:
- `HUB_ID` is the Mercure hub id
- `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`)


Adding Options to a Chat Message
--------------------------------

With a Mercure Chat Message, you can use the `MercureOptions` class to add
message options.

```php
use Symfony\Component\Notifier\Message\ChatMessage;
use Symfony\Component\Notifier\Bridge\Mercure\MercureOptions;

$chatMessage = new ChatMessage('Contribute To Symfony');

$options = new MercureOptions(
['/topic/1', '/topic/2'],
true,
'id',
'type',
1,
['tag' => '1234', 'body' => 'TEST']
);

// Add the custom options to the chat message and send the message
$chatMessage->options($options);

$chatter->send($chatMessage);
```

Resources
---------

Expand Down
Loading