diff --git a/src/bundle/Server.ts b/src/bundle/Server.ts
index d281120d1..c3cfa04aa 100644
--- a/src/bundle/Server.ts
+++ b/src/bundle/Server.ts
@@ -22,6 +22,7 @@ process.on("uncaughtException", console.error);
import http from "http";
import * as Api from "@spacebar/api";
import * as Gateway from "@spacebar/gateway";
+import * as Webrtc from "@spacebar/webrtc";
import { CDNServer } from "@spacebar/cdn";
import express from "express";
import { green, bold } from "picocolors";
@@ -30,18 +31,25 @@ import { Config, initDatabase, Sentry } from "@spacebar/util";
const app = express();
const server = http.createServer();
const port = Number(process.env.PORT) || 3001;
+const wrtcWsPort = Number(process.env.WRTC_WS_PORT) || 3004;
const production = process.env.NODE_ENV == "development" ? false : true;
server.on("request", app);
const api = new Api.SpacebarServer({ server, port, production, app });
const cdn = new CDNServer({ server, port, production, app });
const gateway = new Gateway.Server({ server, port, production });
+const webrtc = new Webrtc.Server({
+ server: undefined,
+ port: wrtcWsPort,
+ production,
+});
process.on("SIGTERM", async () => {
console.log("Shutting down due to SIGTERM");
await gateway.stop();
await cdn.stop();
await api.stop();
+ await webrtc.stop();
server.close();
Sentry.close();
});
@@ -54,7 +62,12 @@ async function main() {
await new Promise((resolve) =>
server.listen({ port }, () => resolve(undefined)),
);
- await Promise.all([api.start(), cdn.start(), gateway.start()]);
+ await Promise.all([
+ api.start(),
+ cdn.start(),
+ gateway.start(),
+ webrtc.start(),
+ ]);
Sentry.errorHandler(app);
|