summary refs log tree commit diff
path: root/src/bundle
diff options
context:
space:
mode:
authordank074 <torresefrain10@gmail.com>2025-06-21 21:41:13 -0500
committerGitHub <noreply@github.com>2025-06-22 12:41:13 +1000
commit526a8da8f509c7320b9b8bc3084fb4d53e88aaf1 (patch)
treeca16b079aa3ced092cf5f06a27f1100e5f556721 /src/bundle
parentsend the real index (diff)
downloadserver-ts-526a8da8f509c7320b9b8bc3084fb4d53e88aaf1.tar.xz
add webrtc support (#1284)
Co-authored-by: MaddyUnderStars <46743919+MaddyUnderStars@users.noreply.github.com>
Diffstat (limited to 'src/bundle')
-rw-r--r--src/bundle/Server.ts15
1 files changed, 14 insertions, 1 deletions
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);