Skip to content

sivert-io/WebSocket-Voice

Repository files navigation

🌩️ Gryt - Modern WebRTC Voice Chat Platform

Welcome to Gryt, a cutting-edge WebRTC-based voice chat platform featuring real-time communication, advanced audio processing, and a beautiful modern interface. Built with TypeScript, React, and Go, Gryt provides a Discord-like experience with enterprise-grade voice quality and reliability.

Preview

License: MIT TypeScript React Go

Want to try Gryt right now? Check out our QUICK-START.md guide for true one-liner setup:

# Docker (easiest)
git clone https://github.com/sivert-io/WebSocket-Voice.git && cd webrtc && docker-compose up -d

# Kubernetes  
git clone https://github.com/sivert-io/WebSocket-Voice.git && cd webrtc && helm install gryt ./helm/gryt

That's it! πŸŽ‰


✨ Features

πŸŽ™οΈ Advanced Voice Communication

  • High-Quality Audio: Crystal-clear voice with noise suppression and echo cancellation
  • Real-time Voice Activity Detection: Visual indicators showing who's speaking
  • Smart Noise Gate: Automatic background noise filtering with customizable thresholds
  • Volume Controls: Independent microphone and output volume with 2x boost capability
  • Mute & Deafen: Full voice controls with server synchronization

πŸŽ›οΈ Professional Audio Processing

  • Enhanced Audio Pipeline: Multi-stage processing (noise gate β†’ volume β†’ mute β†’ output)
  • Real-time Audio Visualization: Frequency spectrum and level meters
  • Loopback Monitoring: Hear yourself to test audio setup
  • Device Management: Hot-swappable microphone and speaker selection
  • Audio Quality Optimization: Automatic gain control and dynamic range compression

🌐 Multi-Server Architecture

  • Server Discovery: Automatic server detection and connection
  • Seamless Server Switching: Switch between voice servers without disconnection
  • Room Isolation: Unique room IDs prevent cross-server interference
  • Connection State Management: Robust handling of network changes and reconnections

🎨 Modern User Interface

  • Beautiful Design: Clean, modern interface built with Radix UI
  • Responsive Layout: Works perfectly on desktop and mobile
  • Real-time Animations: Smooth transitions and visual feedback
  • Dark/Light Themes: Adaptive theming with system preference detection
  • Accessibility: Full keyboard navigation and screen reader support

πŸ”§ Developer Experience

  • TypeScript: Full type safety across the entire stack
  • Modular Architecture: Clean separation of concerns with package-based structure
  • Hot Reload: Instant development feedback with Vite and Bun
  • Comprehensive Logging: Detailed debugging and monitoring capabilities

πŸ—οΈ Architecture

Gryt consists of three main components working together, with authentication provided as a centrally hosted service:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Web Client    β”‚    β”‚  Gryt Servers   β”‚    β”‚   SFU Server    β”‚
β”‚   (React/TS)    │◄──►│   (Node.js)     │◄──►│     (Go)        β”‚
β”‚                 β”‚    β”‚                 β”‚    β”‚                 β”‚
β”‚ β€’ Voice UI      β”‚    β”‚ β€’ Signaling     β”‚    β”‚ β€’ Media Relay   β”‚
β”‚ β€’ Audio Proc.   β”‚    β”‚ β€’ User Mgmt     β”‚    β”‚ β€’ WebRTC        β”‚
β”‚ β€’ Server Mgmt   β”‚    β”‚ β€’ Room Mgmt     β”‚    β”‚ β€’ Track Mgmt    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                β”‚
                       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                       β”‚  Auth Service   β”‚
                       β”‚ (Hosted by Gryt)β”‚
                       β”‚                 β”‚
                       β”‚ β€’ Authenticationβ”‚
                       β”‚ β€’ User Sessions β”‚
                       β”‚ β€’ Security      β”‚
                       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Component Overview

Component Technology Purpose Setup Required
Web Client React + TypeScript User interface and audio processing βœ… Self-hosted
Gryt Server Node.js + TypeScript Signaling and room management βœ… Self-hosted
SFU Server Go + Pion WebRTC Media forwarding and WebRTC βœ… Self-hosted
Auth Service Hosted by Gryt Team Authentication and security 🌐 Centrally hosted

Note: Authentication is provided as a centrally hosted service by the Gryt team. You don't need to set up your own authentication server - just configure your servers to use the official Gryt Auth API.

πŸš€ Quick Start

Prerequisites

  • Node.js 18+ and Bun (for client/server)
  • Go 1.21+ (for SFU)
  • STUN/TURN Server (for production)

Development Setup

  1. Clone the repository

    git clone https://github.com/sivert-io/WebSocket-Voice.git
    cd gryt
  2. Start all services (uses tmux for multi-service development)

    chmod +x start.sh
    ./start.sh

    This starts:

    • SFU Server (Go) on port 5005
    • Web Client (React) on port 5173
    • Gryt Server 1 "Gryta Krutt" on port 5000
    • Gryt Server 2 "Techial" on port 5001
  3. Access the application

    • Open http://localhost:5173 in your browser
    • Create an account or use community access (via centrally hosted auth)
    • Join a voice channel and start chatting!

Manual Setup

If you prefer to start services individually:

# Terminal 1: SFU Server
cd webrtc/sfu-v2
./start.sh

# Terminal 2: Web Client
cd webrtc/client
bun install && bun dev

# Terminal 3: Gryt Server
cd webrtc/server
bun install && bun dev

πŸ› οΈ Production Deployment

Requirements

  • Domain with SSL/TLS: Required for WebRTC in production
  • STUN/TURN Server: We recommend coturn
  • Load Balancer: For multiple Gryt server instances

Environment Configuration

Each component includes an example.env file that you can copy and customize:

SFU Server (copy env.example to .env):

PORT=5005
STUN_SERVERS=stun:stun.l.google.com:19302,stun:stun1.l.google.com:19302

Gryt Server (copy example.env to .env):

# Port clients connect to
PORT=5000

# Your secure SFU host
SFU_WS_HOST="wss://sfu_host.com"

# Comma separated list of URLs
STUN_SERVERS="stun:stun.l.google.com:19302"

# Name of the server
SERVER_NAME="My Brand New Server"

# Icon of the server (filename in the public folder)
SERVER_ICON="example.png"

# Websocket allowed origins
CORS_ORIGIN="https://gryt.chat"

# Websocket secret token (also used for SFU authentication)
SERVER_TOKEN="123"

Web Client: The web client does not require environment variables for basic operation. Users add servers manually through the application interface.

Quick Setup: Copy the example files:

# Server
cd webrtc/server
cp example.env .env

# Client  
cd webrtc/client
cp example.env .env

Authentication Configuration

Authentication is provided by the centrally hosted Gryt Auth service. No additional configuration is required as the auth endpoint is automatically configured to use the official Gryt Auth API at https://auth.gryt.chat.

🎯 Key Features Deep Dive

Voice Controls

  • Mute: Prevents your microphone from transmitting (visual feedback to others)
  • Deafen: Mutes all incoming audio (local only, others still see you as connected)
  • Push-to-Talk: Coming soon
  • Voice Activation: Automatic transmission based on voice activity

Audio Processing Pipeline

Microphone β†’ Noise Gate β†’ Volume Control β†’ Mute β†’ SFU β†’ Other Users
                ↓
            Visual Feedback (accurate representation of transmitted audio)

Server Management

  • Multi-server Support: Connect to multiple Gryt servers simultaneously
  • Seamless Switching: Change servers without losing voice connection
  • Room Isolation: Unique room IDs prevent conflicts between servers
  • Connection Recovery: Automatic reconnection with state preservation

🀝 Contributing

We welcome contributions! Here's how to get started:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes with proper TypeScript types
  4. Add tests for new functionality
  5. Commit your changes: git commit -m 'Add amazing feature'
  6. Push to the branch: git push origin feature/amazing-feature
  7. Open a Pull Request

Development Guidelines

  • Follow TypeScript best practices
  • Use proper error handling and logging
  • Write comprehensive tests
  • Update documentation for new features
  • Ensure accessibility compliance

πŸ“š Documentation

πŸ› Troubleshooting

Common Issues

Audio not working?

  • Check microphone permissions in browser
  • Verify STUN/TURN server configuration
  • Ensure HTTPS/WSS in production

Connection issues?

  • Check firewall settings for WebRTC ports
  • Verify server URLs and SSL certificates
  • Check browser console for detailed errors

Performance issues?

  • Monitor CPU usage during audio processing
  • Check network bandwidth and latency
  • Verify browser WebRTC support

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

✍️ Authors

Sivert Gullberg Hansen Ola Hulleberg
Lead Developer & Architecture Authentication & Backend

Built with ❀️ for the future of voice communication

Report Bug β€’ Request Feature β€’ Documentation

About

Voice communication through WebRTC and WebSockets

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •