drogonframework / drogonframework/drogon

http server responding using server sent events to a browser's eventsource api

Open
#1,295 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
14.3k
Forks
1.4k
Avg merge
1d 13h
Merged PRs (30d)
14

Description

Hi,
I'm looking for advice on how I should have my http server respond to a browser eventsource() with keep alive where the server should send notifications on occasion to the client browser.
I have tried having the drogon server respond using an `event/text-stream` header with a `data` field. The browser will then receive and recognize the response, but it seems that then the connection disconnects (the eventsource error handler triggers and the browser retries again after 5s).
I'm aware of the new stream response, but I'm looking for something slightly different. The stream response sets up a callback which gets called without an option to throttle and is therefore not suitable for sending a notification only once in a while.
Thanks in advance.
-Eyal

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.