This commit is contained in:
Spencer Pogorzelski 2023-08-18 13:55:32 -07:00
parent 82a314b54f
commit 85107cbbeb
3 changed files with 87 additions and 96 deletions

View file

@ -5,11 +5,10 @@ import expressWs from "express-ws";
import { AdriftServer, connectTracker } from "./server";
import WebSocket from "isomorphic-ws";
import { answerRtc, bufferToArrayBuffer, connect } from "./rtc";
import { answerRtc, bufferToArrayBuffer } from "./rtc";
dotenv.config();
const app = express() as unknown as expressWs.Application;
expressWs(app);
@ -23,9 +22,6 @@ app.use((_req, res, next) => {
next();
});
app.post("/connect", (req, res) => {
const data = req.body;
answerRtc(data, (d) => {
@ -51,12 +47,9 @@ app.ws("/dev-ws", (ws, _req) => {
});
try {
let tracker = new WebSocket("ws://localhost:17776/join");
tracker.onerror = console.error;
connectTracker(tracker);
} catch (_) {
}
} catch (_) {}
app.listen(3000, () => console.log("listening"));