feat: add Server-Sent Events (SSE) support#60
Merged
Conversation
- Add SSE stream detection in fetch proxy (text/event-stream content-type) - Parse SSE events (data, event, id fields) and send via eventSourceMessage - Handle Network.eventSourceMessageReceived CDP protocol for DevTools display - Identify SSE responses as 'EventSource' type in Network panel - Add comprehensive tests for SSE functionality - Add SSE example endpoint in koa-esm demo This enables real-time viewing of SSE events in Chrome DevTools Network panel, similar to how WebSocket messages are displayed.
Owner
|
😊Thanks for your PR, I'll take a look over the weekend or on Friday |
Owner
|
It's great, it looks like it's done to the basics mvp. |
Owner
|
If you have time, you can improve it later:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR: feat: add Server-Sent Events (SSE) support
Summary
Add support for Server-Sent Events (SSE) / EventStream in Chrome DevTools Network panel.
Problem
Previously, SSE responses (content-type: text/event-stream) were not properly displayed in DevTools because:
response.clone().arrayBuffer()waits for the entire stream to end before returning dataSolution
text/event-streamcontent-typeReadableStreamto read chunks incrementallyNetwork.eventSourceMessageReceivedCDP protocolEventSourcetype in the Network panelChanges
packages/network-debugger/src/core/fetch.ts: Add SSE stream handlingpackages/network-debugger/src/fork/module/network/index.ts: Add eventSourceMessage handlerTesting
All 841 tests pass including new SSE-specific tests.