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

Turbo stream source #415

Merged
merged 4 commits into from Jun 19, 2022
Merged

Turbo stream source #415

merged 4 commits into from Jun 19, 2022

Commits on Oct 3, 2021

  1. Improve test coverage for streams over SSE

    Add a `<form>` element to the `src/tests/fixtures/stream.html` file so
    that tests can exercise receiving `<turbo-stream>` elements
    asynchronously over an `EventSource` instance that polls for Server-sent
    Events.
    
    Extend the `src/tests/server.ts` to account for the `Accept:
    text/event-stream` requests that are made by browsers via the `new
    EventSource(...)` instance.
    seanpdoyle committed Oct 3, 2021
    Configuration menu
    Copy the full SHA
    8f94b5c View commit details
    Browse the repository at this point in the history
  2. Introduce <turbo-stream-source>

    Closes hotwired#413
    
    The `<turbo-stream-source>` element accepts a `[src]` attribute, and
    uses that to connect Turbo to poll for streams published on the server
    side.
    
    When the element is connected to the document, the stream source is
    connected. When the element is disconnected, the stream is disconnected.
    
    When declared with an `ws://` or `wss://` URL, the underlying Stream
    Source will be a `WebSocket` instance. Otherwise, the connection is
    through an `EventSource`.
    
    Since the document's `<head>` is persistent across navigations, the
    `<turbo-stream-source>` is meant to be mounted within the `<body>`
    element.
    
    Typical full page navigations driven by Turbo will result in the
    `<body>` being discarded and replaced with the resulting document. It's
    the server's responsibility to ensure that the element is present on
    each page that requires streaming.
    seanpdoyle committed Oct 3, 2021
    Configuration menu
    Copy the full SHA
    feb52fa View commit details
    Browse the repository at this point in the history

Commits on Jun 19, 2022

  1. Configuration menu
    Copy the full SHA
    b89c8ef View commit details
    Browse the repository at this point in the history
  2. fix lint errors

    seanpdoyle committed Jun 19, 2022
    Configuration menu
    Copy the full SHA
    a73c269 View commit details
    Browse the repository at this point in the history