mirror of
https://github.com/infinite-iroha/touka.git
synced 2026-02-02 16:31:11 +08:00
fix
This commit is contained in:
parent
b4e073ae2f
commit
38ff5126e3
1 changed files with 49 additions and 48 deletions
3
sse.go
3
sse.go
|
|
@ -6,7 +6,6 @@ package touka
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
|
@ -66,6 +65,7 @@ func (e *Event) Render(w io.Writer) error {
|
|||
// 这是推荐的、更简单安全的方式, 采用阻塞和回调的设计, 框架负责管理连接生命周期.
|
||||
//
|
||||
// 详细用法:
|
||||
//
|
||||
// r.GET("/sse/callback", func(c *touka.Context) {
|
||||
// // streamer 回调函数会在一个循环中被调用.
|
||||
// c.EventStream(func(w io.Writer) bool {
|
||||
|
|
@ -117,6 +117,7 @@ func (c *Context) EventStream(streamer func(w io.Writer) bool) {
|
|||
// - 为防止 goroutine 泄漏, 建议发送方在 select 中同时监听 c.Request.Context().Done().
|
||||
//
|
||||
// 详细用法:
|
||||
//
|
||||
// r.GET("/sse/channel", func(c *touka.Context) {
|
||||
// eventChan, errChan := c.EventStreamChan()
|
||||
//
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue