@@ -71,7 +71,7 @@ Run the following command to start it:
7171
7272.. code-block :: terminal
7373
74- $ JWT_KEY ='aVerySecretKey' ADDR ='localhost:3000' ALLOW_ANONYMOUS=1 CORS_ALLOWED_ORIGINS=* ./mercure
74+ $ ./mercure --jwt-key ='aVerySecretKey' --addr ='localhost:3000' --allow-anonymous --cors-allowed-origins='*'
7575
7676 .. note ::
7777
@@ -94,7 +94,7 @@ The preferred way to configure the MercureBundle is using
9494Set the URL of your hub as the value of the ``MERCURE_PUBLISH_URL `` env var.
9595The ``.env `` file of your project has been updated by the Flex recipe to
9696provide example values.
97- Set it to the URL of the Mercure Hub (``http://localhost:3000/hub `` by default).
97+ Set it to the URL of the Mercure Hub (``http://localhost:3000/.well-known/mercure `` by default).
9898
9999In addition, the Symfony application must bear a `JSON Web Token `_ (JWT)
100100to the Mercure Hub to be authorized to publish updates.
@@ -189,7 +189,7 @@ Subscribing to updates in JavaScript is straightforward:
189189
190190.. code-block :: javascript
191191
192- const eventSource = new EventSource (' http://localhost:3000/hub ?topic=' + encodeURIComponent (' http://example.com/books/1' ));
192+ const eventSource = new EventSource (' http://localhost:3000/.well-known/mercure ?topic=' + encodeURIComponent (' http://example.com/books/1' ));
193193 eventSource .onmessage = event => {
194194 // Will be called every time an update is published by the server
195195 console .log (JSON .parse (event .data ));
@@ -201,7 +201,7 @@ and to use URI Templates as patterns:
201201.. code-block :: javascript
202202
203203 // URL is a built-in JavaScript class to manipulate URLs
204- const url = new URL (' http://localhost:3000/hub ' );
204+ const url = new URL (' http://localhost:3000/.well-known/mercure ' );
205205 url .searchParams .append (' topic' , ' http://example.com/books/1' );
206206 // Subscribe to updates of several Book resources
207207 url .searchParams .append (' topic' , ' http://example.com/books/2' );
@@ -295,7 +295,7 @@ by using the ``AbstractController::addLink`` helper method::
295295 // This parameter is automatically created by the MercureBundle
296296 $hubUrl = $this->getParameter('mercure.default_hub');
297297
298- // Link: <http://localhost:3000/hub >; rel="mercure"
298+ // Link: <http://localhost:3000/.well-known/mercure >; rel="mercure"
299299 $this->addLink($request, new Link('mercure', $hubUrl));
300300
301301 return $this->json([
@@ -311,7 +311,7 @@ and to subscribe to it:
311311.. code-block :: javascript
312312
313313 // Fetch the original resource served by the Symfony web API
314- fetch (' /books/1' ) // Has Link: <http://localhost:3000/hub >; rel="mercure"
314+ fetch (' /books/1' ) // Has Link: <http://localhost:3000/.well-known/mercure >; rel="mercure"
315315 .then (response => {
316316 // Extract the hub URL from the Link header
317317 const hubUrl = response .headers .get (' Link' ).match (/ <([^ >] + )>;\s + rel=(?:mercure| "[^ "] * mercure[^ "] * ")/ )[1 ];
@@ -420,7 +420,7 @@ And here is the controller::
420420 $response = $this->json(['@id' => '/demo/books/1', 'availability' => 'https://schema.org/InStock']);
421421 $response->headers->set(
422422 'set-cookie',
423- sprintf('mercureAuthorization=%s; path=/hub ; secure; httponly; SameSite=strict', $token)
423+ sprintf('mercureAuthorization=%s; path=/.well-known/mercure ; secure; httponly; SameSite=strict', $token)
424424 );
425425
426426 return $response;
@@ -460,7 +460,7 @@ Then, reference this service in the bundle configuration:
460460 mercure :
461461 hubs :
462462 default :
463- url : https://mercure-hub.example.com/hub
463+ url : https://mercure-hub.example.com/.well-known/mercure
464464 jwt_provider : App\Mercure\MyJwtProvider
465465
466466 .. code-block :: xml
@@ -470,7 +470,7 @@ Then, reference this service in the bundle configuration:
470470 <config >
471471 <hub
472472 name =" default"
473- url =" https://mercure-hub.example.com/hub "
473+ url =" https://mercure-hub.example.com/.well-known/mercure "
474474 jwt-provider =" App\Mercure\MyJwtProvider"
475475 />
476476 </config >
@@ -483,7 +483,7 @@ Then, reference this service in the bundle configuration:
483483 $container->loadFromExtension('mercure', [
484484 'hubs' => [
485485 'default' => [
486- 'url' => 'https://mercure-hub.example.com/hub ',
486+ 'url' => 'https://mercure-hub.example.com/.well-known/mercure ',
487487 'jwt_provider' => MyJwtProvider::class,
488488 ],
489489 ],
0 commit comments