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

Express: SSE not working #41

Closed
x7airworker opened this issue Apr 21, 2022 · 0 comments
Closed

Express: SSE not working #41

x7airworker opened this issue Apr 21, 2022 · 0 comments

Comments

@x7airworker
Copy link

Using the following code, the connection can be opened, but no data gets sended:

app.get('/stream', (req, res) => {
    res.setHeader('Cache-Control', 'no-cache');
    res.setHeader('Content-Type', 'text/event-stream');
    res.setHeader('Connection', 'keep-alive');
    res.flushHeaders();
    
    res.write("data: Hello World!\n\n");
})

With res.end() I am able to close to connection and send all messages at once.
This issue could also be related to #22.

SymphonyIceAttack added a commit to SymphonyIceAttack/vite-plugin-node that referenced this issue Apr 2, 2023
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

No branches or pull requests

1 participant