ensure that messages are received through ack

master
Alex 2022-01-30 20:41:15 +01:00
parent 306dac252f
commit b2a3601ce2
2 changed files with 9 additions and 2 deletions

View File

@ -3,6 +3,7 @@ web_socket:
protocol: ws
host: 127.0.0.1
port: 50003
ack_timeouts: [2, 3]
web:
voice_address: "https://dev.voice.krakatoa-roleplay.umbach.dev/"
mongodb:

View File

@ -29,8 +29,6 @@ func HandleWebMessage(isVoice bool, conn *websocket.Conn, uuid string, msg []byt
status, cmdID, dest, cmdNumber, args := kraProtocol.DecodeWebMessage(msg)
// TODO: kraProtocol.StatusMessageAlreadyInQueue
if status == kraProtocol.StatusReply {
if isVoice {
for _, data := range webClient.VoiceCmdIDsByBackend {
@ -131,6 +129,14 @@ func HandleWebMessage(isVoice bool, conn *websocket.Conn, uuid string, msg []byt
raw := kraProtocol.EncodeWebMessage(kraProtocol.StatusErrTryAgain, cmdID, cmdNumber, args)
webClient.SendBinaryMessage(conn, raw)
if status == kraProtocol.StatusGet {
if isVoice {
webClient.SendVoiceQueueMessages = append(webClient.SendVoiceQueueMessages, &structs.SendQueueMessage{MessageRaw: raw, CmdID: cmdID, TrySendCount: 0, Time: time.Now()})
} else {
webClient.SendMobileQueueMessages = append(webClient.SendMobileQueueMessages, &structs.SendQueueMessage{MessageRaw: raw, CmdID: cmdID, TrySendCount: 0, Time: time.Now()})
}
}
}
return
} else { // web