Send our local ICE candidate to Unreal Engine using websockets.
(wsConn *websocket.Conn, localIceCandidate *webrtc.ICECandidate)
| 259 | |
| 260 | // Send our local ICE candidate to Unreal Engine using websockets. |
| 261 | func sendLocalIceCandidate(wsConn *websocket.Conn, localIceCandidate *webrtc.ICECandidate) { |
| 262 | var iceCandidateInit webrtc.ICECandidateInit = localIceCandidate.ToJSON() |
| 263 | var respPayload ueICECandidateResp = ueICECandidateResp{Type: "iceCandidate", Candidate: iceCandidateInit} |
| 264 | |
| 265 | jsonPayload, err := json.Marshal(respPayload) |
| 266 | |
| 267 | if err != nil { |
| 268 | log.Printf("Error turning local ice candidate into JSON. Error: %s", err.Error()) |
| 269 | } |
| 270 | |
| 271 | jsonStr := string(jsonPayload) |
| 272 | writeWSMessage(wsConn, jsonStr) |
| 273 | fmt.Println(fmt.Sprintf("Sending our local ice candidate to UE...%s", jsonStr)) |
| 274 | } |
| 275 | |
| 276 | func createUDPConnection(address string, port int, payloadType uint8) (*udpConn, error) { |
| 277 |
no test coverage detected