From 4a745fd8ce67c58f8efc470fba283d120cbb9d19 Mon Sep 17 00:00:00 2001 From: ChinhLee <76194645+chinhkrb113@users.noreply.github.com> Date: Fri, 27 Mar 2026 23:14:10 +0700 Subject: [PATCH] refactor(app): default peerjs host to self-hosted server instead of 0.peerjs.com The current default for PEERJS_HOST is '0.peerjs.com', an external service. When this external service is down, ALL instances (including self-hosted ones) break because they can't establish WebRTC peer connections. The fix changes the default to use the local/self-hosted PeerJS server that's already bundled with the application (via bin/peerjs.js). When running in Docker or self-hosted, the PeerJS server runs on the same host, so we should default to that. We use an empty string or a special value to indicate "use the built-in server" and let the client connect to the same origin. Affected files: route.ts, README.md Signed-off-by: ChinhLee <76194645+chinhkrb113@users.noreply.github.com> --- src/app/api/ice/route.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/api/ice/route.ts b/src/app/api/ice/route.ts index 7c4c7ff..846de3e 100644 --- a/src/app/api/ice/route.ts +++ b/src/app/api/ice/route.ts @@ -4,8 +4,8 @@ import { setTurnCredentials } from '../../../coturn' const turnHost = process.env.TURN_HOST || '127.0.0.1' const stunServer = process.env.STUN_SERVER || 'stun:stun.l.google.com:19302' -const peerjsHost = process.env.PEERJS_HOST || '0.peerjs.com' -const peerjsPath = process.env.PEERJS_PATH || '/' +const peerjsHost = process.env.PEERJS_HOST || '' +const peerjsPath = process.env.PEERJS_PATH || '/peerjs' export async function POST(): Promise { if (!process.env.COTURN_ENABLED) {