allow tracker to reject outdated servers

This commit is contained in:
CoolElectronics 2023-08-20 10:09:54 -04:00
parent 55dece7bc3
commit c6f06d9724
No known key found for this signature in database
GPG key ID: F63593D168636C50
5 changed files with 19 additions and 9 deletions

View file

@ -6,6 +6,7 @@ import { AdriftServer, connectTracker } from "./server";
import WebSocket from "isomorphic-ws";
import { answerRtc, bufferToArrayBuffer } from "./rtc";
import { PROTOCOL_VERSION } from "protocol";
dotenv.config();
@ -50,9 +51,9 @@ app.ws("/dev-ws", (ws, _req) => {
});
try {
let tracker = new WebSocket("ws://localhost:17776/join");
let tracker = new WebSocket(`ws://localhost:17776/join?protocol=${PROTOCOL_VERSION}`);
tracker.onerror = console.error;
connectTracker(tracker);
} catch (_) {}
} catch (_) { }
app.listen(3000, () => console.log("listening"));