Myx de2d3300d4 fix: Fix users unable to see or hear each other in voice channels due to
stale server sockets, passive non-initiators, and race conditions
during peer connection setup.

Fix users unable to see or hear each other in voice channels due to
stale server sockets, passive non-initiators, and race conditions
during peer connection setup.

Server:
- Close stale WebSocket connections sharing the same oderId in
  handleIdentify instead of letting them linger up to 45s
- Make user_joined/user_left broadcasts identity-aware so duplicate
  sockets don't produce phantom join/leave events
- Include serverIds in user_left payload for multi-room presence
- Simplify findUserByOderId now that stale sockets are cleaned up

Client - signaling:
- Add fallback offer system with 1s timer for missed user_joined races
- Add non-initiator takeover after 5s when the initiator fails to send
  an offer (NON_INITIATOR_GIVE_UP_MS)
- Scope peerServerMap per signaling URL to prevent cross-server
  collisions
- Add socket identity guards on all signaling event handlers
- Replace canReusePeerConnection with hasActivePeerConnection and
  isPeerConnectionNegotiating with extended grace periods

Client - peer connections:
- Extract replaceUnusablePeer helper to deduplicate stale peer
  replacement in offer and ICE handlers
- Add stale connectionstatechange guard to ignore events from replaced
  RTCPeerConnection instances
- Use deterministic initiator election in peer recovery reconnects
- Track createdAt on PeerData for staleness detection

Client - presence:
- Add multi-room presence tracking via presenceServerIds on User
- Replace clearUsers + individual userJoined with syncServerPresence
  for atomic server roster updates
- Make userLeft handle partial server removal instead of full eviction

Documentation:
- Add server-side connection hygiene, non-initiator takeover, and stale
  peer replacement sections to the realtime README
2026-04-04 02:47:58 +02:00
2026-03-04 03:56:23 +01:00
2026-03-29 23:55:24 +02:00
2025-12-28 08:23:30 +01:00
2026-03-15 16:12:21 +01:00
2026-03-29 23:55:24 +02:00
2026-03-29 23:55:24 +02:00
2026-03-02 00:13:34 +01:00
2026-04-02 00:08:38 +02:00
2026-04-02 00:08:38 +02:00
2026-03-23 01:34:18 +01:00

Toju / Zoracord

Desktop chat app with four parts:

  • src/ Angular client
  • electron/ desktop shell, IPC, and local database
  • server/ directory server, join request API, and websocket events
  • website/ Toju website served at toju.app

Install

  1. Run npm install
  2. Run cd server && npm install
  3. Copy .env.example to .env

Config

Root .env:

  • SSL=true uses HTTPS for Angular, the server, and Electron dev mode
  • PORT=3001 changes the server port in local development and overrides the server app setting

If SSL=true, run ./generate-cert.sh once.

Server files:

  • server/data/variables.json holds klipyApiKey
  • server/data/variables.json also holds releaseManifestUrl for desktop auto updates
  • server/data/variables.json can now also hold optional serverHost (an IP address or hostname to bind to)
  • server/data/variables.json can now also hold serverProtocol (http or https)
  • server/data/variables.json can now also hold serverPort (1-65535)
  • When serverProtocol is https, the certificate must match the configured serverHost or IP

Main commands

  • npm run dev starts Angular, the server, and Electron
  • npm run electron:dev starts Angular and Electron
  • npm run server:dev starts only the server
  • npm run build builds the Angular client
  • npm run build:electron builds the Electron code
  • npm run build:all builds client, Electron, and server
  • npm run lint runs ESLint
  • npm run lint:fix formats templates, sorts template props, and fixes lint issues
  • npm run test runs Angular tests

Server project

The code in server/ is a small Node and TypeScript service. It handles the public server directory, join requests, websocket updates, and Klipy routes.

Inside server/:

  • npm run dev starts the server with reload
  • npm run build compiles to dist/
  • npm run start runs the compiled server

Images

Main Toju app Structure

Path Description
src/app/ Main application root
src/app/core/ Core utilities, services, models
src/app/domains/ Domain-driven modules
src/app/features/ UI feature modules
src/app/infrastructure/ Low-level infrastructure (DB, realtime, etc.)
src/app/shared/ Shared UI components
src/app/shared-kernel/ Shared domain contracts & models
src/app/store/ Global state management
src/assets/ Static assets
src/environments/ Environment configs

Domains

Path Link
Attachment app/domains/attachment/README.md
Auth app/domains/auth/README.md
Chat app/domains/chat/README.md
Screen Share app/domains/screen-share/README.md
Server Directory app/domains/server-directory/README.md
Voice Connection app/domains/voice-connection/README.md
Voice Session app/domains/voice-session/README.md
Domains Root app/domains/README.md

Infrastructure

Path Link
Persistence src/app/infrastructure/persistence/README.md
Realtime src/app/infrastructure/realtime/README.md

Shared Kernel

Path Link
Shared Kernel src/app/shared-kernel/README.md

Entry Points

File Link
Main main.ts
Index HTML index.html
App Root app/app.ts
Description
No description provided
Readme 20 MiB
2026-04-02 07:29:12 +00:00
Languages
JavaScript 46.5%
TypeScript 42.8%
HTML 9.8%
SCSS 0.8%