Skip to content

Commit 961ef08

Browse files
committed
Fix after review
1 parent b1c1c22 commit 961ef08

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

src/Turbo/CHANGELOG.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# CHANGELOG
22

3-
## 2.23.0
3+
## 2.24.0
44

5-
- Add support for providing options to the EventSource via `turbo_stream_listen`
5+
- Add support for authentication to the EventSource via `turbo_stream_listen`
66

77
## 2.22.0
88

src/Turbo/config/services.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
->set('turbo.twig.runtime', TurboRuntime::class)
5454
->args([
5555
tagged_locator('turbo.renderer.stream_listen', 'transport'),
56-
abstract_arg('default'),
56+
abstract_arg('default_transport'),
5757
])
5858
->tag('twig.runtime')
5959

src/Turbo/doc/index.rst

+3
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,9 @@ Let's create our chat::
750750
</turbo-frame>
751751
{% endblock %}
752752

753+
If you're using a private hub, you can add ``{ withCredentials: true }``
754+
as ``turbo_stream_listen()`` third argument to authenticate with the hub
755+
753756
.. code-block:: html+twig
754757

755758
{# chat/message.stream.html.twig #}

src/Turbo/src/Twig/TurboRuntime.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
*
2323
* @internal
2424
*/
25-
class TurboRuntime implements RuntimeExtensionInterface
25+
final class TurboRuntime implements RuntimeExtensionInterface
2626
{
2727
public function __construct(
2828
private ContainerInterface $turboStreamListenRenderers,
29-
private string $default,
29+
private readonly string $defaultTransport,
3030
) {
3131
}
3232

@@ -36,7 +36,7 @@ public function __construct(
3636
*/
3737
public function renderTurboStreamListen(Environment $env, $topic, ?string $transport = null, array $options = []): string
3838
{
39-
$options['transport'] = $transport ??= $this->default;
39+
$options['transport'] = $transport ??= $this->defaultTransport;
4040

4141
if (!$this->turboStreamListenRenderers->has($transport)) {
4242
throw new \InvalidArgumentException(\sprintf('The Turbo stream transport "%s" does not exist.', $transport));

0 commit comments

Comments
 (0)