Files
core/lib/doc/dever-http-live.md
T
2026-11-03 03:32:07 +00:00

49 lines
1002 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 流式响应
在请求处理函数中按块发送响应,结束时释放会话资源。
## dever.http.LiveLimits
逐块限额及空闲期限,心跳期限必须短于空闲期限。
字段:
- `chunk_bytes`:单块上限
- `idle_ms`:普通流空闲期限
- `heartbeat_ms`:SSE 心跳周期
## dever.http.defaultLiveLimits
默认每块 64 KiB、空闲期限 60 秒、心跳间隔 15 秒。
## dever.http.serveLive
处理可分块回复的 HTTP 请求,route 通过 reply 写入响应。
## dever.http.serveLiveTls
使用 TLS 处理可分块回复的 HTTP 请求。
## dever.http.respond
通过 reply 一次发送完整响应。
## dever.http.start
发送流式响应的状态码和响应头。
## dever.http.write
向已开始的流式响应写入一块正文。
## dever.http.finish
结束流式响应。
## dever.http.wroteLive
写入成功时继续执行,失败时传播错误。
## dever.http.closedLive
结束响应成功时继续执行,失败时传播错误。