diff --git a/multiplayer_client.gd b/multiplayer_client.gd index 4dac680..05fcd22 100644 --- a/multiplayer_client.gd +++ b/multiplayer_client.gd @@ -4,8 +4,8 @@ extends Node This module sets up WebRTC peer connections. """ -# var multiplayer_url = "wss://webrtc-signaller.deno.dev:443" -var multiplayer_url = "ws://localhost:8888" +var multiplayer_url = "wss://webrtc-signaller.deno.dev:443" +# var multiplayer_url = "ws://localhost:8888" # var multiplayer_url = "ws://echo.websocket.org" var webrtc_ice_servers = [ { "urls": ["stun:stun.l.google.com:19302"] }, diff --git a/server.ts b/server.ts index eb9af2b..6f50384 100644 --- a/server.ts +++ b/server.ts @@ -225,6 +225,7 @@ interface ClientMessage { function onMessage(client: Client, ev: MessageEvent) { // TODO: log who from? const msg = ev.data.trim(); + if (msg === "pong") return; console.log("Client Message Received", msg); if (msg === "init") { client.send(buildMessage("init", { id: client.id, name: client.name })); diff --git a/signaller_client.gd b/signaller_client.gd index 45e8f67..b36c49d 100644 --- a/signaller_client.gd +++ b/signaller_client.gd @@ -78,7 +78,7 @@ func _connected(protocol = ""): func _process(_delta: float): var status: int = ws.get_connection_status() - if status in [WebSocketClient.CONNECTION_CONNECTED, WebSocketClient.CONNECTION_CONNECTING]: + if status == WebSocketClient.CONNECTION_CONNECTED or status == WebSocketClient.CONNECTION_CONNECTING: ws.poll() func join_lobby(id: String): @@ -157,7 +157,7 @@ func handle_message(data: Dictionary): print("Answer received - Data: %s" % JSON.print(data["data"])) emit_signal("answer_received", data["data"]) "ping": - print("Signaller Ping") + # print("Signaller Ping") _send("pong") _: print("Unhandled Message - Data: %s" % JSON.print(data))