Documentation ¶
Index ¶
- Constants
- type Config
- type HTTP
- func (h *HTTP) Close(sid string) error
- func (h *HTTP) GetAllSID() []string
- func (h *HTTP) Handler(w http.ResponseWriter, req *http.Request)
- func (h *HTTP) Read(srv *cs.Srv) (sid string, req *cs.Request, err error)
- func (h *HTTP) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (h *HTTP) Srv() *cs.Srv
- func (h *HTTP) Write(sid string, resp *cs.Response) error
- type SSEConn
- type SSEMsgType
Constants ¶
View Source
const ( SSEEvent = 0 // 使用事件, cmd 和 data 分开 SSEMessage = 1 // 使用消息, cmd 和 data 都放到sse 的 data 域 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { MsgType SSEMsgType // 消息类型 HeartbeatTime time.Duration // SSE 心跳时长 SIDKey string // sid 的 cookie key 名称 }
Config 配置项
type HTTP ¶
type HTTP struct {
// contains filtered or unexported fields
}
HTTP cs 的 HTTP 适配器
func (*HTTP) Handler ¶
func (h *HTTP) Handler(w http.ResponseWriter, req *http.Request)
Handler impl http.HandlerFunc to handler http request
Click to show internal directories.
Click to hide internal directories.