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

Split client and server transporters #13158

Open
cooolbros opened this issue Dec 14, 2024 · 0 comments
Open

Split client and server transporters #13158

cooolbros opened this issue Dec 14, 2024 · 0 comments
Labels
feature / enhancement New feature or request

Comments

@cooolbros
Copy link
Contributor

Describe the problem

The transport hook added in 2.11.0 is insufficient for returning long lived variables from load functions, such as ReadableStreams/async iterators and Observables

Describe the proposed solution

Split the transport encode/decode into hooks.server.js and hooks.client.js to allow for long lived variables to be serialized into IDs by the user, then revived on the client using an SSE or Websocket connection, similar to how Promises are already serialized into unique IDs that are attached to the window and resolved later.

Ideally this should also not leak the server implementation to the client

Alternatives considered

You can return an ID from a load function, then set up the SSE connection from the client, but this is brittle and not reusable

Importance

nice to have

Additional Information

Feature announcement: https://bsky.app/profile/svelte.dev/post/3ld4ncjryfs2g

Feature PR: #13149
PR that would fix this: #13125

Similar to: #13156

@eltigerchino eltigerchino added the feature / enhancement New feature or request label Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature / enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants