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