reply handling
parent
60ff336abd
commit
e14a04f81c
|
@ -16,7 +16,7 @@ import (
|
|||
"krakatoa.net/backend/modules/structs"
|
||||
)
|
||||
|
||||
func HandleWebMessage(isVoice bool, conn *websocket.Conn, uuid string, status int, cmdID int, dest int, cmdNumber int, args string) {
|
||||
func HandleWebMessage(isVoice bool, conn *websocket.Conn, uuid string, msg []byte) {
|
||||
var err error
|
||||
var raw []byte
|
||||
|
||||
|
@ -27,16 +27,16 @@ func HandleWebMessage(isVoice bool, conn *websocket.Conn, uuid string, status in
|
|||
return
|
||||
}
|
||||
|
||||
if status == kraProtocol.StatusReply {
|
||||
// TODO: TODO: handling reply
|
||||
status, cmdID, dest, cmdNumber, args := kraProtocol.DecodeMessage(msg)
|
||||
|
||||
if isVoice {
|
||||
if isCmdIDInList(webClient.VoiceCmdIDs, cmdID) {
|
||||
if status == kraProtocol.StatusReply {
|
||||
// TODO: TODO: handling reply - answering message to target dest (ex. GameServer-1)
|
||||
|
||||
if isVoice && isCmdIDInList(webClient.VoiceCmdIDs, cmdID) {
|
||||
webClient.RemoveVoiceCmdID(cmdID)
|
||||
} else {
|
||||
} else if isCmdIDInList(webClient.MobileCmdIDs, cmdID) {
|
||||
webClient.RemoveMobileCmdID(cmdID)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -51,12 +51,10 @@ func RunHub() {
|
|||
case data := <-broadcast:
|
||||
logger.Web.Println("message received", data.Msg)
|
||||
|
||||
status, cmdID, dest, cmdNumber, args := kraProtocol.DecodeMessage(data.Msg)
|
||||
|
||||
// check if it is a connection from voice or mobile
|
||||
for _, client := range cache.WebClients {
|
||||
if client.MobileConn == data.Conn || client.VoiceConn == data.Conn {
|
||||
go serverCommunication.HandleWebMessage(client.VoiceConn == data.Conn, data.Conn, client.Uuid, status, cmdID, dest, cmdNumber, args)
|
||||
go serverCommunication.HandleWebMessage(client.VoiceConn == data.Conn, data.Conn, client.Uuid, data.Msg)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue