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

Bypass worker parsing in response streams #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cleaton
Copy link

@cleaton cleaton commented Sep 15, 2022

Enable direct connection between DO & Client.
Remove response clone
Add prepare command to support loading dependency from git

Comment on lines +35 to +42
// redirect stream from DO directly to client without parsing to keep stream connection client <-> DO
// @ts-ignore
context.___stream_response = await durableObject.fetch(request.url, {
method: 'POST',
body,
headers,
});
return {} as any;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks intriguing, can you explain a little bit more about how this does replace the flow from before?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dan-lee The existing flow is unwrapping the eventstream in the worker, and re-encoding it to send to the client. This should not be needed, the worker just needs pass the DO response to the client. It's my understanding that the current implementation will keep both the DO instance & the worker reciving the initial response active for the length of the stream. While if the response is just proxied only the DO will be kept alive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants