feat: 新增 snowid(雪花ID+GORM钩子模板,吸收go-hua); wsc新增SessionClient会话层(吸收两端internal/cloud); jwtx重写为标准三段式HS256+密钥显式传参
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
// session_protocol.go 定义会话层协议:会话级 action 常量与心跳/注册消息。
|
||||
// 业务 action(业务消息)由各业务模块自行定义,不放在框架层。
|
||||
package wsc
|
||||
|
||||
// 会话级 action 常量:心跳与注册(所有业务共用)。
|
||||
const (
|
||||
ActionPing = "ping"
|
||||
ActionPong = "pong"
|
||||
ActionRegister = "register"
|
||||
)
|
||||
|
||||
// PingReq 心跳请求(无业务字段)。
|
||||
type PingReq struct{}
|
||||
|
||||
// PingResp 心跳响应(action=pong)。
|
||||
type PingResp struct {
|
||||
Time int64 `json:"time"`
|
||||
}
|
||||
|
||||
// RegisterResp 注册(上线)响应(action=register,与请求共用同一 action)。
|
||||
type RegisterResp struct {
|
||||
Success bool `json:"success"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
Reference in New Issue
Block a user