34 lines
706 B
Go
34 lines
706 B
Go
|
// package asChat -----------------------------
|
||
|
// @file : chatRoom.go
|
||
|
// @author : JJXu
|
||
|
// @contact : wavingbear@163.com
|
||
|
// @time : 2022/10/21 18:17:17
|
||
|
// -------------------------------------------
|
||
|
package asChat
|
||
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
|
"fonchain-fiee/pkg/common/ws"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
ChatRoom = ws.NewChatRoom()
|
||
|
)
|
||
|
|
||
|
type WsInfo struct {
|
||
|
Type ws.WsType `json:"type"` //消息类型
|
||
|
Content any `json:"content"`
|
||
|
}
|
||
|
|
||
|
func WsMessageRegisterCallback(clientId string, sessionId string) []byte {
|
||
|
var errMsg = WsInfo{
|
||
|
Type: ws.RegisterType,
|
||
|
Content: map[string]string{
|
||
|
//"clientId": clientId,
|
||
|
"sessionId": sessionId,
|
||
|
},
|
||
|
}
|
||
|
byteMsg, _ := json.Marshal(errMsg)
|
||
|
return byteMsg
|
||
|
}
|