Skip to content

Commit 2aacd4c

Browse files
committed
docs: adapt the Laravel Octane Mercure config to the 1.0 hub
The publisher_jwt and subscriber_jwt directives only work in the compatibility mode of the hub, which FrankenPHP is built without. Octane writes every entry of the mercure array as a Caddyfile line, so the issuer block is passed as a multi-line value.
1 parent d948c53 commit 2aacd4c

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

docs/laravel.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,23 @@ return [
194194

195195
'mercure' => [
196196
'anonymous' => true,
197-
'publisher_jwt' => '!ChangeThisMercureHubJWTSecretKey!',
198-
'subscriber_jwt' => '!ChangeThisMercureHubJWTSecretKey!',
197+
// The issuer of the access tokens, and the keys verifying them
198+
'issuer' => <<<'CADDYFILE'
199+
https://localhost {
200+
publisher {
201+
jwt !ChangeThisMercureHubJWTSecretKey!
202+
}
203+
subscriber {
204+
jwt !ChangeThisMercureHubJWTSecretKey!
205+
}
206+
}
207+
CADDYFILE,
199208
],
200209
];
201210
```
202211

203-
You can use [all directives supported by Mercure](https://mercure.rocks/docs/hub/config#directives) in this array.
212+
Octane writes each entry of this array as a `<key> <value>` line of the `mercure` block of the `Caddyfile`, so you can use [all directives supported by Mercure](https://mercure.rocks/docs/hub/config#directives) in it.
213+
The `publisher_jwt` and `subscriber_jwt` directives of the 0.x hub aren't available: they need a compatibility mode that FrankenPHP doesn't ship, see [the Mercure documentation](mercure.md#enabling-mercure).
204214

205215
To publish and subscribe to updates, we recommend using the [Laravel Mercure Broadcaster](https://github.com/mvanduijker/laravel-mercure-broadcaster) library.
206216
Alternatively, see [the Mercure documentation](mercure.md) to do it in pure PHP and JavaScript.

0 commit comments

Comments
 (0)