mirror of
https://github.com/giongto35/cloud-game.git
synced 2026-01-23 10:35:44 +00:00
Clean
This commit is contained in:
parent
9bde5b14dd
commit
5cf49fdebf
2 changed files with 3 additions and 4 deletions
4
main.go
4
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 {
|
||||
|
|
|
|||
|
|
@ -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)}));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue