@@ -282,6 +282,11 @@ URL in a dedicated HTML element:
282282 {{ mercure('https://example.com/books/1')|json_encode(constant('JSON_UNESCAPED_SLASHES') b-or constant('JSON_HEX_TAG'))|raw }}
283283 </script>
284284
285+ <!-- with Stimulus -->
286+ <div {{ stimulus_controller('my-controller', {
287+ mercureUrl: mercure('https://example.com/books/1'),
288+ }) }}>
289+
285290Then retrieve it from your JS file:
286291
287292.. code-block :: javascript
@@ -290,6 +295,9 @@ Then retrieve it from your JS file:
290295 const eventSource = new EventSource (url);
291296 // ...
292297
298+ // with Stimulus
299+ this .eventSource = new EventSource (this .mercureUrlValue );
300+
293301 Mercure also allows subscribing to several topics,
294302and to use URI Templates or the special value ``* `` (matched by all topics)
295303as patterns:
@@ -407,7 +415,7 @@ of the ``Update`` constructor to ``true``::
407415 $update = new Update(
408416 'https://example.com/books/1',
409417 json_encode(['status' => 'OutOfStock']),
410- true // private
418+ private: true
411419 );
412420
413421 // Publisher's JWT must contain this topic, a URI template it matches or * in mercure.publish or you'll get a 401
@@ -704,6 +712,8 @@ enable it::
704712 :alt: The Mercure panel of the Symfony Profiler, showing information like time, memory, topics and data of each message sent by Mercure.
705713 :class: with-browser
706714
715+ The Mercure hub itself provides a debug tool that can be enabled and available on `/.well-known/mercure/ui/ `
716+
707717Async dispatching
708718-----------------
709719
0 commit comments