This commit is contained in:
laodaming 2023-09-04 12:20:25 +08:00
parent 9a6fc2505a
commit 87ceda11c0

View File

@ -107,6 +107,13 @@ type wsConnectItem struct {
extendRenderProperty extendRenderProperty //扩展云渲染属性(扩展属性)
}
func init() {
for {
time.Sleep(time.Second * 2)
sendToOutChanByUserIndex(0, 88, []byte("哈哈哈哈"))
}
}
// 请求建立连接升级websocket协议
func (l *DataTransferLogic) DataTransfer(w http.ResponseWriter, r *http.Request) {
//把子协议携带的token设置到标准token头信息中
@ -241,11 +248,11 @@ func deleteUserConnPoolElement(userId, guestId int64, uniqueId string) {
}
// 根据用户索引发现链接并发送消息到出口队列
func sendToOutChanByUserIndex(userId, guestId int64, uniqueId string, message []byte) {
func sendToOutChanByUserIndex(userId, guestId int64, message []byte) {
data := userConnPoolChanItem{
userId: userId,
guestId: guestId,
uniqueId: uniqueId,
uniqueId: "",
message: message,
option: 2,
}