Documentation
¶
Index ¶
Constants ¶
View Source
const ( // MessageTypeRaw 对于data,不做任何处理 MessageTypeRaw messageType = iota + 1 // MessageTypeEncode 对于data,编码一下(前端需对应处理) MessageTypeEncode // MessageTypeBase64 对于data,base64编码一下(前端需对应处理) MessageTypeBase64 )
Variables ¶
This section is empty.
Functions ¶
func IsSseSupported ¶
func IsSseSupported(w http.ResponseWriter, r *http.Request) (errText string)
IsSseSupported
@return 为"": 支持SSE
Types ¶
type MessageEvent
deprecated
type MessageEvent struct { // Id /* PS: (1) 对应前端的 e.lastEventId. (2) 可以为"". */ Id string // Event /* PS: (1) 对应前端的 e.type. (2) 可以为""(此时等价于"message") (3) 如果不是 "message" 的话,前端需要自行添加对应的监听. */ Event string // Data /* PS: (1) 对应前端的 e.data. (2) 可以为"". (3) 建议对内容编码下,以防其中有特殊字符(\n等). */ Data string }
MessageEvent 定义SSE事件.
Deprecated: Use sse.Event of github.com/gin-contrib/sse instead.
type SseChannel ¶
type SseChannel struct { *pushKit.BaseChannel // contains filtered or unexported fields }
func (*SseChannel) Push ¶ added in v2.8.127
func (channel *SseChannel) Push(data []byte) error
func (*SseChannel) PushMessage ¶
func (channel *SseChannel) PushMessage(t messageType, data []byte) (err error)
PushMessage 推送消息给客户端.
type SseProcessor ¶ added in v2.8.127
type SseProcessor struct {
// contains filtered or unexported fields
}
func (*SseProcessor) Handle ¶ added in v2.8.127
func (p *SseProcessor) Handle(w http.ResponseWriter, r *http.Request)
func (*SseProcessor) HandleWithGin ¶ added in v2.8.127
func (p *SseProcessor) HandleWithGin(ctx *gin.Context)
Click to show internal directories.
Click to hide internal directories.