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

add HTTP server-sent-events(SSE) example in brpc http server #2375

Merged
merged 1 commit into from
Oct 3, 2023

Conversation

thorneliu
Copy link
Contributor

@thorneliu thorneliu commented Sep 7, 2023

What problem does this PR solve?

Issue Number:
NA

Problem Summary:
添加了使用brpc 实现HTTP SSE功能的例子,可以用于brpc支持如大语言模型推理服务化等功能

What is changed and the side effects?

Changed:
在example/http_c++中添加了一个HttpSSEServiceImpl实现。
具体而言,server端依次发送以下内容

  1. 发送包含如下头部信息的HTTP response
Content-Type: text/event-stream
Cache-Control: no-cache
Connection: keep-alive
  1. 后续HTTP server基于ProgressiveAttachment向客户段发送SSE的消息,格式:
[field]: value\n

其中, field可以取四个值,它们分别是:data、event、id、retry
Side effects:

  • Performance effects(性能影响):
    NO impact
  • Breaking backward compatibility(向后兼容性):
    NO compatibiltiy issue

Check List:

  • Please make sure your changes are compilable(请确保你的更改可以通过编译).
  • When providing us with a new feature, it is best to add related tests(如果你向我们增加一个新的功能, 请添加相关测试).
  • Please follow Contributor Covenant Code of Conduct.(请遵循贡献者准则).

@wwbmmm
Copy link
Contributor

wwbmmm commented Sep 26, 2023

LGTM

@Huixxi Huixxi merged commit aa0f052 into apache:master Oct 3, 2023
16 checks passed
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.

3 participants