Error during connection
This commit is contained in:
parent
ff009674bb
commit
aad8b99dc1
|
@ -4,7 +4,7 @@ const MultiplayerClient = preload("multiplayer_client.gd")
|
||||||
|
|
||||||
onready var client = MultiplayerClient.new()
|
onready var client = MultiplayerClient.new()
|
||||||
|
|
||||||
const MULTIPLAYER_URL = "ws://localhost:9080"
|
const MULTIPLAYER_URL = "wss://webrtc-signaller.deno.dev/"
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
client.connect("lobby_joined", self, "_lobby_joined")
|
client.connect("lobby_joined", self, "_lobby_joined")
|
||||||
|
|
|
@ -216,6 +216,7 @@ for await (const conn of server) {
|
||||||
const httpConn = Deno.serveHttp(conn);
|
const httpConn = Deno.serveHttp(conn);
|
||||||
for await (const requestEvent of httpConn) {
|
for await (const requestEvent of httpConn) {
|
||||||
if (requestEvent) {
|
if (requestEvent) {
|
||||||
|
try {
|
||||||
const { socket, response } = Deno.upgradeWebSocket(
|
const { socket, response } = Deno.upgradeWebSocket(
|
||||||
requestEvent.request,
|
requestEvent.request,
|
||||||
);
|
);
|
||||||
|
@ -260,6 +261,9 @@ for await (const conn of server) {
|
||||||
};
|
};
|
||||||
socket.onerror = (e) => console.error("WebSocket error:", e);
|
socket.onerror = (e) => console.error("WebSocket error:", e);
|
||||||
requestEvent.respondWith(response);
|
requestEvent.respondWith(response);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(`Error during connection:`, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
Loading…
Reference in a new issue