diff --git a/machinery/src/routers/mqtt/main.go b/machinery/src/routers/mqtt/main.go index 1e3e4fa..2f01af6 100644 --- a/machinery/src/routers/mqtt/main.go +++ b/machinery/src/routers/mqtt/main.go @@ -457,7 +457,12 @@ func HandleReceiveHDCandidates(mqttClient mqtt.Client, hubKey string, payload mo if receiveHDCandidatesPayload.Timestamp != 0 { if communication.CameraConnected { - channel := webrtc.CandidateArrays[receiveHDCandidatesPayload.SessionID] + key := configuration.Config.Key + "/" + receiveHDCandidatesPayload.SessionID + channel := webrtc.CandidateArrays[key] + if channel == nil { + channel = make(chan string) + webrtc.CandidateArrays[key] = channel + } log.Log.Info("HandleReceiveHDCandidates: " + receiveHDCandidatesPayload.Candidate) channel <- receiveHDCandidatesPayload.Candidate } else { diff --git a/machinery/src/webrtc/main.go b/machinery/src/webrtc/main.go index 057d1eb..0ebd8f3 100644 --- a/machinery/src/webrtc/main.go +++ b/machinery/src/webrtc/main.go @@ -125,6 +125,7 @@ func InitializeWebRTCConnection(configuration *models.Configuration, communicati Credential: w.TurnServersCredential, }, }, + ICETransportPolicy: pionWebRTC.ICETransportPolicyRelay, }, ) @@ -215,7 +216,7 @@ func InitializeWebRTCConnection(configuration *models.Configuration, communicati payload, err := models.PackageMQTTMessage(configuration, message) if err == nil { log.Log.Info("InitializeWebRTCConnection:" + string(candateBinary)) - token := mqttClient.Publish("kerberos/hub/"+hubKey, 0, false, payload) + token := mqttClient.Publish("kerberos/hub/"+hubKey, 2, false, payload) token.Wait() } else { log.Log.Info("HandleRequestConfig: something went wrong while sending acknowledge config to hub: " + string(payload)) @@ -241,7 +242,7 @@ func InitializeWebRTCConnection(configuration *models.Configuration, communicati } payload, err := models.PackageMQTTMessage(configuration, message) if err == nil { - token := mqttClient.Publish("kerberos/hub/"+hubKey, 0, false, payload) + token := mqttClient.Publish("kerberos/hub/"+hubKey, 2, false, payload) token.Wait() } else { log.Log.Info("HandleRequestConfig: something went wrong while sending acknowledge config to hub: " + string(payload))