Hide ping/pong messages
This commit is contained in:
parent
8a5a05524e
commit
61b816ed01
|
@ -4,8 +4,8 @@ extends Node
|
||||||
This module sets up WebRTC peer connections.
|
This module sets up WebRTC peer connections.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# var multiplayer_url = "wss://webrtc-signaller.deno.dev:443"
|
var multiplayer_url = "wss://webrtc-signaller.deno.dev:443"
|
||||||
var multiplayer_url = "ws://localhost:8888"
|
# var multiplayer_url = "ws://localhost:8888"
|
||||||
# var multiplayer_url = "ws://echo.websocket.org"
|
# var multiplayer_url = "ws://echo.websocket.org"
|
||||||
var webrtc_ice_servers = [
|
var webrtc_ice_servers = [
|
||||||
{ "urls": ["stun:stun.l.google.com:19302"] },
|
{ "urls": ["stun:stun.l.google.com:19302"] },
|
||||||
|
|
|
@ -225,6 +225,7 @@ interface ClientMessage {
|
||||||
function onMessage(client: Client, ev: MessageEvent) {
|
function onMessage(client: Client, ev: MessageEvent) {
|
||||||
// TODO: log who from?
|
// TODO: log who from?
|
||||||
const msg = ev.data.trim();
|
const msg = ev.data.trim();
|
||||||
|
if (msg === "pong") return;
|
||||||
console.log("Client Message Received", msg);
|
console.log("Client Message Received", msg);
|
||||||
if (msg === "init") {
|
if (msg === "init") {
|
||||||
client.send(buildMessage("init", { id: client.id, name: client.name }));
|
client.send(buildMessage("init", { id: client.id, name: client.name }));
|
||||||
|
|
|
@ -78,7 +78,7 @@ func _connected(protocol = ""):
|
||||||
|
|
||||||
func _process(_delta: float):
|
func _process(_delta: float):
|
||||||
var status: int = ws.get_connection_status()
|
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()
|
ws.poll()
|
||||||
|
|
||||||
func join_lobby(id: String):
|
func join_lobby(id: String):
|
||||||
|
@ -157,7 +157,7 @@ func handle_message(data: Dictionary):
|
||||||
print("Answer received - Data: %s" % JSON.print(data["data"]))
|
print("Answer received - Data: %s" % JSON.print(data["data"]))
|
||||||
emit_signal("answer_received", data["data"])
|
emit_signal("answer_received", data["data"])
|
||||||
"ping":
|
"ping":
|
||||||
print("Signaller Ping")
|
# print("Signaller Ping")
|
||||||
_send("pong")
|
_send("pong")
|
||||||
_: print("Unhandled Message - Data: %s" % JSON.print(data))
|
_: print("Unhandled Message - Data: %s" % JSON.print(data))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue