-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
[Mercure] Explain how to differentiate between multiple topics in JavaScript #20574
Comments
As stated in the Mercure spec, the recommended way is to embed the topic in the payload. For instance, if you use an hypermedia format such as Atom, HTML or JSON-LD, you can just add the topic in an |
Page: https://symfony.com/doc/6.4/mercure.html#subscribing Closes symfony#20574 Closes symfony/mercure-bundle#71 Closes symfony/mercure-bundle#82 Info is taken from symfony#20574 (comment)
OK, I added that at #20580 But what is |
It's to customize the SSE types. This allows to trigger ad-hoc JS events instead of the generic |
Info is taken from symfony/symfony-docs#20574 (comment) Why is the default value `null` and not `message`?
At https://symfony.com/doc/current/mercure.html#subscribing it is described how to subscribe to multiple topics:
But when looking at the received data, how is it possible to know which is coming from topic1 and which from topic2?
At https://stackoverflow.com/a/71905295/1668200 it is suggested to use
Update()
s fifth argument$type
, and in JavaScript add multiple event listeners toEventSource
. Is this really the recommended way? If yes, then the recommendation would be to use the (more or less) same string for$topic
and$type
?The text was updated successfully, but these errors were encountered: