Skip to content

Symfony: Two topics on one page #82

@7cookies

Description

@7cookies

Hi,

I'm using two topics on my symfony-project:

/user/notification/{userid} -> Send notifications to user (flash messages, statusupdates)
/user/messenger/{userid} -> Messages from other users

Both (private) topics were created by diefferent symfony-services.
At the client-side I'm using different stimulus-controllers:

"eventEndpoint": mercure(notificationChannelName, { subscribe: notificationChannelName })
"eventEndpoint": mercure(messengerChannelName, { subscribe: messengerChannelName})

Both topics are working perfect.
But when I'm using both on the same page, I get this error:
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 have no idea how to fix this.

I think I can set the cookie by myself:
$authorization->setCookie($request, ['/user/notification/{userid}','/user/messenger/{userid}']);

But the mercure-twig-helper still tries to set the cookie. -> Error again.

What can I do?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy