-
Notifications
You must be signed in to change notification settings - Fork 2
/
types.go
34 lines (28 loc) · 891 Bytes
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package xhttp
import (
"encoding/json"
"time"
"github.com/eyasliu/cs"
)
// Config 配置项
type Config struct {
MsgType SSEMsgType // 消息类型
HeartbeatTime time.Duration // SSE 心跳时长
SIDKey string // sid 的 cookie key 名称
}
type reqMessage struct {
sid string
data *cs.Request
}
type responseData struct {
Cmd string `json:"cmd"` // message command, use for route
Seqno string `json:"seqno"` // seq number,the request id
Code int `json:"code"` // response status code
Msg string `json:"msg"` // response status message text
Data interface{} `json:"data"` // response data
}
type requestData struct {
Cmd string `json:"cmd"` // message command, use for route
Seqno string `json:"seqno"` // seq number,the request id
Data json.RawMessage `json:"data"` // response data
}