-
-
Notifications
You must be signed in to change notification settings - Fork 24
Closed
Description
Hello,
Assume that I want to subscribe to two (or more) private updates. By intuition I'd write this:
<div data-mercure-url="{{ mercure('https://example.com/user/3', { subscribe: 'https://example.com/user/3' }) }}"></div>
...
<div data-mercure-url="{{ mercure('https://example.com/books/1', { subscribe: 'https://example.com/books/1' }) }}"></div>
But doing so will cause the following exception from Symfony\Component\Mercure\Authorization::updateCookies
:
An exception has been thrown during the rendering of a template ("The "mercureAuthorization" cookie for the "default hub" has already been set. You cannot set it two times during the same request.").
I am currently working around this by specifying all subscribing URLs in one of the mercure()
function call:
<div data-mercure-url="{{ mercure('https://example.com/user/3', { subscribe: ['https://example.com/user/3', 'https://example.com/books/1'] }) }}"></div>
...
<div data-mercure-url="{{ mercure('https://example.com/books/1' }}"></div>
This works, but doesn't look straightforward. Is this a limitation of the current implmentation of the bundle, or am I doing it wrongly?
Metadata
Metadata
Assignees
Labels
No labels