From 5cf49fdebfe8b82ba6ca6b49bcac3228b95eeddc Mon Sep 17 00:00:00 2001 From: giongto35 Date: Wed, 10 Apr 2019 00:02:10 +0800 Subject: [PATCH] Clean --- main.go | 4 +++- static/js/ws.js | 3 --- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index b9c55ff9..d476b5b2 100644 --- a/main.go +++ b/main.go @@ -145,7 +145,8 @@ func ws(w http.ResponseWriter, r *http.Request) { break } - // connectivity + // SDP connection initializations follows WebRTC convention + // https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/Protocols switch req.ID { case "ping": gameName = req.Data @@ -165,6 +166,7 @@ func ws(w http.ResponseWriter, r *http.Request) { res.Data = localSession case "candidate": + // Unuse code hi := pionRTC.ICECandidateInit{} err = json.Unmarshal([]byte(req.Data), &hi) if err != nil { diff --git a/static/js/ws.js b/static/js/ws.js index 348abb5a..0278f2ff 100644 --- a/static/js/ws.js +++ b/static/js/ws.js @@ -73,10 +73,8 @@ function startGame() { else if (pc.iceConnectionState === "disconnected") { endInput(); } - } - // stream channel pc.ontrack = function (event) { log("New stream, yay!"); @@ -94,7 +92,6 @@ function startGame() { conn.send(JSON.stringify({"id": "sdp", "data": session})); } else { console.log(JSON.stringify(event.candidate)); - // conn.send(JSON.stringify({"id": "candidate", "data": JSON.stringify(event.candidate)})); } }