Description
Hi,
I've been trying to get a list of users connected, and thought of using the subscription endpoint alongside with its SSE topics to be able to keep a list of online user by checking for subscriptions against /users/1234/notifications
, where 1234 is the user id, which is a topic everyone on the app is always subscribing to.
On the worker which will be checking those, I'm generating a JWT with the subscribe *
permissions then I call the endpoint:
$resp = $this->httpClient->request(
'GET',
'http://mercure/.well-known/mercure/subscriptions',
[
'headers' => [
'Authorization' => 'Bearer ' .$mercureJwt,
],
],
);
I indeed get all the logged in users. But when I try to specify a topic selector to have only those subscription and not every subscription for every topic, I get an empty response...
$resp = $this->httpClient->request(
'GET',
'http://mercure/.well-known/mercure/subscriptions/' . urlencode('/users/{*}/notifications'), // I've also tried with urlencode('/users/{id}/notifications') and urlencode('/users/*/notifications')
[
'headers' => [
'Authorization' => 'Bearer ' .$mercureJwt,
],
],
);
Am I missing something or is there an issue ? I've seen this GH issue #706 but the proposed PR is merged and I'm running latest caddy/mercure hub
Activity