本文整理汇总了Golang中NetCore.Client.RemoveCloseCB方法的典型用法代码示例。如果您正苦于以下问题:Golang Client.RemoveCloseCB方法的具体用法?Golang Client.RemoveCloseCB怎么用?Golang Client.RemoveCloseCB使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetCore.Client
的用法示例。
在下文中一共展示了Client.RemoveCloseCB方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: handleClientLeaveRoom
func handleClientLeaveRoom(client *NetCore.Client, msg *NetCore.NetMsg) bool {
client.RemoveCloseCB("leaveRoom")
msg.Buf = ErrConf.GetEmptyRspBuffer(ErrConf.NO_ERR)
client.SendMsg(msg)
if room, ok := idRoomMap[client.Id]; ok {
Logger.Info(LogConf.WorkerClientJob, client.Idx, "client leave room id: %d RoomId: %d", client.Id, room.Id)
notify := &LeaveRoomNotify{
Id: NetCore.ClientIDType(client.Id),
}
msg.Cmd = MsgConf.ClientLeaveRoomNotify
if buf, err := json.Marshal(notify); err == nil {
msg.Buf = buf
} else {
return false
}
delete(room.Guests, client.Id)
if len(room.Guests) > 0 {
for _, v := range room.Guests {
v.SendMsg(msg)
}
} else {
delete(rooms, room.Id)
}
}
Logger.Info(LogConf.WorkerClientJob, client.Idx, "handleClientLeaveRoom client Idx: %d id: %d", client.Idx, client.Id)
return true
}