public function supports(MessageInterface
$message): bool
{ return $message instanceof ChatMessage
&& (null ===
$message->
getOptions() ||
$message->
getOptions() instanceof MercureOptions
);
} /**
* @see https://symfony.com/doc/current/mercure.html#publishing
*/
protected function doSend(MessageInterface
$message): SentMessage
{ if (!
$message instanceof ChatMessage
) { throw new UnsupportedMessageTypeException(__CLASS__, ChatMessage::
class,
$message);
} if (($options =
$message->
getOptions()) && !
$options instanceof MercureOptions
) { throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" for options.', __CLASS__, MercureOptions::
class));
} $options ??=
new MercureOptions($this->topics
);
// @see https://www.w3.org/TR/activitystreams-core/#jsonld
$update =
new Update($options->
getTopics() ??
$this->topics,
json_encode([ '@context' => 'https://www.w3.org/ns/activitystreams',