本文整理匯總了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
}