Hide ping/pong messages
This commit is contained in:
parent
8a5a05524e
commit
61b816ed01
3 changed files with 5 additions and 4 deletions
|
@ -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"] },
|
||||
|
|
|
@ -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 }));
|
||||
|
|
|
@ -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))
|
||||
|
||||
|
|
Loading…
Reference in a new issue