mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-04 00:10:25 +08:00
refactor: websocket支持单用户多连接
This commit is contained in:
@@ -14,6 +14,8 @@ type SysMsg struct {
|
||||
Category string `json:"category"` // 消息类别
|
||||
Title string `json:"title"` // 消息标题
|
||||
Msg string `json:"msg"` // 消息内容
|
||||
|
||||
ClientId string
|
||||
}
|
||||
|
||||
func (sm *SysMsg) WithTitle(title string) *SysMsg {
|
||||
@@ -31,6 +33,11 @@ func (sm *SysMsg) WithMsg(msg any) *SysMsg {
|
||||
return sm
|
||||
}
|
||||
|
||||
func (sm *SysMsg) WithClientId(clientId string) *SysMsg {
|
||||
sm.ClientId = clientId
|
||||
return sm
|
||||
}
|
||||
|
||||
// 普通消息
|
||||
func InfoSysMsg(title string, msg any) *SysMsg {
|
||||
return &SysMsg{Type: InfoSysMsgType, Title: title, Msg: stringx.AnyToStr(msg)}
|
||||
|
||||
Reference in New Issue
Block a user