Skip to content

Server-sent events #919

Answered by ngzhian
richardhozak asked this question in Q&A
Aug 16, 2019 · 2 comments · 1 reply
Discussion options

You must be logged in to vote

@Zxey in case you're still figuring this out, I wanted to use SSE to have live reload for blogging. ngzhian/blog@e76e964#diff-b388e57e18c6815f3bdd3a6412184385 is what I ended up with.

I used uWebSockets to listen on 9001, when I do curl localhost:9001 it sends a message to a connected session (by keeping the HttpResponse in a global object). The browser first establishes the connection by creating a new EventSource('http://localhost:9001/eventsource'), see the same commit. So far it has worked okay for me.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@richardhozak
Comment options

Answer selected by richardhozak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #919 on December 09, 2020 03:16.