Skip to content
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

[Question] How publish/subscribe private message #926

Open
kevcomparadise opened this issue Jul 22, 2024 · 3 comments
Open

[Question] How publish/subscribe private message #926

kevcomparadise opened this issue Jul 22, 2024 · 3 comments
Labels
wontfix This will not be worked on

Comments

@kevcomparadise
Copy link

Hi,

I am trying to get private messages working on Mercure, but I am unable to receive the messages. Could you provide me with the steps to follow?

I have configured the JWT for the subscriber like this:
{ "mercure": { "publish": [ "*" ] } }

And the JWT for the publisher like this:
{ "mercure": { "subscribe": [ "https://example.com/users/foo/{?topic}" ] } }

There are no errors when I publish with this configuration, but when I check the second parameter "topic" and set "private=On", my client stops receiving anything (without this, it receives just fine).

image

Did I miss something?

P.S.: I have tried with urlencode() and without, with the same result. (#591 (comment))

@kevcomparadise kevcomparadise changed the title [Question] Who pushlish/subscribe private message [Question] How publish/subscribe private message Jul 22, 2024
@dunglas
Copy link
Owner

dunglas commented Jul 22, 2024

Can you show us the headers of the SSE request? The JWT must be in a cookie or an Authorization header. Double check that it is sent properly.

Also, put the hub in debug mode and check the logs, you'll see more details.

@kevcomparadise
Copy link
Author

Thanks for your response

Capture d’écran du 2024-07-22 22-53-34

Token : eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtZXJjdXJlIjp7InN1YnNjcmliZSI6WyJodHRwczovL2V4YW1wbGUuY29tL3VzZXJzL2Zvby97P3RvcGljfSJdfX0.et4JVCzC1cUMYv52od-oyQbFEx7547INTYFs1RtzSLM

Log of subscriber :
mercure-1 | {"level":"info","ts":1721681751.3551211,"logger":"http.handlers.mercure","msg":"New subscriber","subscriber":{"id":"urn:uuid:1fa20f31-3bb0-4446-b22a-9a6a0a1ad36a","last_event_id":"","remote_addr":"172.29.0.1:53430","topic_selectors":["https://example.com/users/foo/{?topic}"],"topics":["https://example.com/books/1"]}}

Log publish :
mercure-1 | {"level":"debug","ts":1721681911.0625815,"logger":"http.handlers.mercure","msg":"Update published","update":{"id":"urn:uuid:5233012e-2aa1-468e-86ee-4582087b5df7","type":"","retry":0,"topics":["https://example.com/users/foo/?topic=https://example.com/books/1"],"private":true,"data":"{\"hello\" : \"world\"}"},"remote_addr":"172.29.0.1:57898"}

Copy link

stale bot commented Feb 25, 2025

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants