### Install Screego as a Binary Source: https://context7.com/screego/server/llms.txt Download, configure, and start the Screego server as a standalone binary. ```bash # Download latest release for Linux amd64 wget https://github.com/screego/server/releases/latest/download/screego_linux_amd64.tar.gz tar xvf screego_linux_amd64.tar.gz chmod +x screego # Create configuration file cat > screego.config << 'EOF' SCREEGO_EXTERNAL_IP=192.168.1.100 SCREEGO_SECRET=your-secret-key-here SCREEGO_SERVER_ADDRESS=0.0.0.0:5050 SCREEGO_AUTH_MODE=turn EOF # Start the server ./screego serve ``` -------------------------------- ### Start UI Development Server Source: https://github.com/screego/server/blob/master/docs/development.md Execute this command within the 'ui' directory to start the frontend development server. ```bash yarn start ``` -------------------------------- ### Install UI Dependencies Source: https://github.com/screego/server/blob/master/docs/development.md Navigate to the UI directory and install its Node.js dependencies using Yarn. ```bash (cd ui && yarn install) ``` -------------------------------- ### Screego Configuration Example Source: https://github.com/screego/server/blob/master/docs/config.md Reference configuration file demonstrating available settings and structure for the Screego server. ```ini SCREEGO_EXTERNAL_IP= SCREEGO_EXTERNAL_PORT=5000 SCREEGO_SERVER_ADDRESS=0.0.0.0:5000 SCREEGO_TLS=false SCREEGO_TLS_CERT= SCREEGO_TLS_KEY= SCREEGO_AUTH_MODE=token SCREEGO_USERS_FILE= SCREEGO_DATABASE_URL=sqlite:///screego.db SCREEGO_LOG_LEVEL=info ``` -------------------------------- ### WebSocket API - Starting Screen Share Source: https://context7.com/screego/server/llms.txt Begin sharing your screen to all users in the room. ```APIDOC ## WebSocket Message: share ### Description Begins sharing your screen to all users in the room. ### Message Format ```json { "type": "share", "payload": {} } ``` ### Example Usage (JavaScript) Start screen sharing: ```javascript ws.send(JSON.stringify({ type: 'share', payload: {} })); // After sending 'share', the server will respond with a 'hostoffer'. // You need to handle this offer to establish the WebRTC connection. ws.onmessage = (event) => { const msg = JSON.parse(event.data); if (msg.type === 'hostoffer') { // Create RTCPeerConnection and handle offer const pc = new RTCPeerConnection({ iceServers: msg.payload.iceServers }); // ... handle WebRTC negotiation } }; ``` ``` -------------------------------- ### Start Screego Server in Development Source: https://github.com/screego/server/blob/master/docs/development.md Run the Screego server in development mode. Ensure you have a 'screego.config.development.local' file with SCREEGO_EXTERNAL_IP set. ```bash go run . serve ``` -------------------------------- ### Development: Building from Source Source: https://context7.com/screego/server/llms.txt Steps to build Screego from source, including cloning the repository, setting up Go modules, installing UI dependencies, creating a development configuration, and running/building the backend and frontend. ```bash # Clone repository git clone https://github.com/screego/server.git && cd server # Enable Go modules if in GOPATH export GO111MODULE=on # Download dependencies go mod download (cd ui && yarn install) # Create development config cat > screego.config.development.local << 'EOF' SCREEGO_EXTERNAL_IP=YOUR_IP_HERE EOF # Run backend (development mode) go run . serve # Run frontend (in separate terminal) cd ui && yarn start # Build for production (cd ui && yarn build) go build -ldflags "-X main.version=$(git describe --tags HEAD) -X main.mode=prod" -o screego ./main.go ``` -------------------------------- ### Install Screego via FreeBSD Package Manager Source: https://github.com/screego/server/blob/master/docs/install.md Command to install Screego on FreeBSD using the `pkg` package manager. Note that maintenance is not handled by the Screego team. ```bash $ pkg install screego ``` -------------------------------- ### Run Screego Server with Docker (Host Network) Source: https://github.com/screego/server/blob/master/docs/install.md This command starts the Screego server using Docker with the host network mode. Replace EXTERNALIP with your actual external IP address. GITHUB_VERSION should be replaced with the specific version tag. ```bash $ docker run --net=host -e SCREEGO_EXTERNAL_IP=EXTERNALIP ghcr.io/screego/server:GITHUB_VERSION ``` -------------------------------- ### Docker Compose Configuration (Port Mapping) Source: https://github.com/screego/server/blob/master/docs/install.md A docker-compose.yml example for running Screego with explicit port mapping. This configuration is an alternative to using `network_mode: host`. ```yaml version: "3.7" services: screego: image: ghcr.io/screego/server:GITHUB_VERSION ports: - 5050:5050 - 3478:3478 - 50000-50200:50000-50200/udp environment: SCREEGO_EXTERNAL_IP: "192.168.178.2" SCREEGO_TURN_PORT_RANGE: "50000:50200" ``` -------------------------------- ### Docker Compose Configuration (Host Network) Source: https://github.com/screego/server/blob/master/docs/install.md A docker-compose.yml example for running Screego with host network mode. Ensure SCREEGO_EXTERNAL_IP is set to your external IP. ```yaml services: screego: image: ghcr.io/screego/server:GITHUB_VERSION network_mode: host environment: SCREEGO_EXTERNAL_IP: "EXTERNALIP" ``` -------------------------------- ### Lint Source Code with golangci-lint Source: https://github.com/screego/server/blob/master/docs/development.md After installing golangci-lint, use this command to check the Go source code for potential issues. ```bash golangci-lint run ``` -------------------------------- ### Apache Proxy at Sub Path Source: https://github.com/screego/server/blob/master/docs/proxy.md Configure Apache (httpd) to proxy requests to Screego at a sub-path (e.g., /screego/). This setup includes a redirect for the base path and specific proxy directives for the sub-path. Requires mod_proxy, mod_proxy_wstunnel, and mod_proxy_http. Ensure SCREEGO_TRUST_PROXY_HEADERS is enabled. ```apache ServerName screego.example.com Keepalive On Redirect 301 "/screego" "/screego/" # The proxy must preserve the host because screego verifies it with the origin # for WebSocket connections ProxyPreserveHost On # Proxy web socket requests to /stream ProxyPass "/screego/stream" ws://127.0.0.1:5050/stream retry=0 timeout=5 # Proxy all other requests to / ProxyPass "/screego/" http://127.0.0.1:5050/ retry=0 timeout=5 # ^- !!trailing slash is required!! ProxyPassReverse /screego/ http://127.0.0.1:5050/ ``` -------------------------------- ### Nginx Proxy at Sub Path Source: https://github.com/screego/server/blob/master/docs/proxy.md Configure Nginx to proxy requests to Screego when it's hosted at a sub-path (e.g., /screego/). This setup includes a rewrite rule to strip the sub-path before proxying. Ensure SCREEGO_TRUST_PROXY_HEADERS is enabled. ```nginx upstream screego { # Set this to the address configured in # SCREEGO_SERVER_ADDRESS. Default 5050 server 127.0.0.1:5050; } server { listen 80; # Here goes your domain / subdomain server_name screego.example.com; location /screego/ { rewrite ^/screego(/.*) $1 break; # Proxy to screego proxy_pass http://screego; proxy_http_version 1.1; # Set headers for proxying WebSocket proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_redirect http:// $scheme://; # Set proxy headers proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto http; # The proxy must preserve the host because screego verifies it with the origin # for WebSocket connections proxy_set_header Host $http_host; } } ``` -------------------------------- ### Build UI for Production Source: https://github.com/screego/server/blob/master/docs/development.md Navigate to the UI directory and run this command to build the static assets for the frontend. ```bash (cd ui && yarn build) ``` -------------------------------- ### Download Go Dependencies Source: https://github.com/screego/server/blob/master/docs/development.md Download the necessary Go module dependencies for the server. ```bash go mod download ``` -------------------------------- ### Configure Authentication Source: https://context7.com/screego/server/llms.txt Set authentication modes, user file paths, and session parameters. ```bash # Authentication modes: # - "all": Login always required # - "turn": Login required only for TURN connections (default) # - "none": No login required SCREEGO_AUTH_MODE=turn # Users file location (bcrypt hashed passwords) SCREEGO_USERS_FILE=/etc/screego/users # Session timeout in seconds (0 = browser session only) SCREEGO_SESSION_TIMEOUT_SECONDS=3600 # Secret for cookie authentication (auto-generated if not set) SCREEGO_SECRET=your-32-byte-secret-key ``` -------------------------------- ### Configure TLS Source: https://context7.com/screego/server/llms.txt Enable HTTPS by providing certificate files and setting the server address. ```bash # Enable TLS with certificate files SCREEGO_SERVER_TLS=true SCREEGO_TLS_CERT_FILE=/etc/ssl/certs/screego.crt SCREEGO_TLS_KEY_FILE=/etc/ssl/private/screego.key # Server address (supports host:port or Unix socket) SCREEGO_SERVER_ADDRESS=0.0.0.0:5050 SCREEGO_SERVER_ADDRESS=unix:/var/run/screego.socket ``` -------------------------------- ### Build Production Binary Source: https://github.com/screego/server/blob/master/docs/development.md Compile the Screego server into a production-ready binary. This command embeds version and mode information. ```bash go build -ldflags "-X main.version=$(git describe --tags HEAD) -X main.mode=prod" -o screego ./main.go ``` -------------------------------- ### Deploy Screego with Docker Source: https://context7.com/screego/server/llms.txt Commands to identify the external IP and run the server using host networking or Docker Compose. ```bash # Find your external IP curl 'https://api.ipify.org' # Run with host networking (recommended) docker run --net=host -e SCREEGO_EXTERNAL_IP=192.168.1.100 ghcr.io/screego/server:latest # Docker Compose configuration cat > docker-compose.yml << 'EOF' services: screego: image: ghcr.io/screego/server:latest network_mode: host environment: SCREEGO_EXTERNAL_IP: "192.168.1.100" SCREEGO_SECRET: "your-secret-key-here" SCREEGO_SERVER_TLS: "false" SCREEGO_AUTH_MODE: "turn" EOF docker-compose up -d ``` -------------------------------- ### Download Screego Server Binary Source: https://github.com/screego/server/blob/master/docs/install.md Command to download the Screego server binary archive using wget. Replace GITHUB_VERSION and {PLATFORM} with appropriate values. ```bash $ wget https://github.com/screego/server/releases/download/vGITHUB_VERSION/screego_GITHUB_VERSION_{PLATFORM}.tar.gz ``` -------------------------------- ### Execute Screego Server Binary Source: https://github.com/screego/server/blob/master/docs/install.md Commands to run the Screego server binary after extraction and making it executable. Use `screego.exe` on Windows. ```bash $ ./screego # on windows $ screego.exe ``` -------------------------------- ### Room URL Parameters: Auto-Create Room Source: https://context7.com/screego/server/llms.txt Use URL parameters to control room creation behavior. `create=true` automatically creates the room if it doesn't exist. ```bash # Access room with auto-create enabled # If room doesn't exist, it will be created automatically https://app.screego.net/?room=my-team-standup&create=true # Regular room join (fails if room doesn't exist) https://app.screego.net/?room=existing-room ``` -------------------------------- ### Enable Go Modules Source: https://github.com/screego/server/blob/master/docs/development.md If your development environment is within your GOPATH, explicitly enable Go modules using this environment variable. ```bash export GO111MODULE=on ``` -------------------------------- ### Screego Configuration File Source: https://context7.com/screego/server/llms.txt The main configuration file for the Screego server, defining network, security, and TURN server settings. ```ini # screego.config # Required: External IP for WebRTC SCREEGO_EXTERNAL_IP=192.168.1.100 # Security SCREEGO_SECRET=your-super-secret-key-32bytes SCREEGO_AUTH_MODE=turn SCREEGO_USERS_FILE=/etc/screego/users SCREEGO_SESSION_TIMEOUT_SECONDS=0 # TLS (or use reverse proxy) SCREEGO_SERVER_TLS=false SCREEGO_TLS_CERT_FILE= SCREEGO_TLS_KEY_FILE= # Server SCREEGO_SERVER_ADDRESS=0.0.0.0:5050 SCREEGO_TRUST_PROXY_HEADERS=false SCREEGO_CORS_ALLOWED_ORIGINS= # TURN SCREEGO_TURN_ADDRESS=0.0.0.0:3478 SCREEGO_TURN_PORT_RANGE=50000:55000 SCREEGO_TURN_DENY_PEERS=0.0.0.0/8,127.0.0.1/8,::/128,::1/128,fe80::/10 # Room behavior SCREEGO_CLOSE_ROOM_WHEN_OWNER_LEAVES=true # Monitoring SCREEGO_LOG_LEVEL=info SCREEGO_PROMETHEUS=false ``` -------------------------------- ### Configure External IP Source: https://context7.com/screego/server/llms.txt Set the external IP for TURN server reachability using static IPs, dual-stack, or DNS resolution. ```bash # Static IPv4 address SCREEGO_EXTERNAL_IP=192.168.1.100 # Dual-stack IPv4 and IPv6 SCREEGO_EXTERNAL_IP=192.168.1.100,2a01:c22:a87c:e500:2d8:61ff:fec7:f92a # Dynamic IP via DNS lookup SCREEGO_EXTERNAL_IP=dns:app.screego.net # DNS lookup with custom DNS server SCREEGO_EXTERNAL_IP=dns:app.screego.net@9.9.9.9:53 ``` -------------------------------- ### Generate Password Hashes Source: https://context7.com/screego/server/llms.txt Use the CLI to generate bcrypt hashes for user authentication and populate the users file. ```bash # Interactive password entry ./screego hash --name "alice" # Enter Password: ******** # alice:$2a$12$WEfYCnWGk0PDzbATLTNiTuoZ7e/43v6DM/h7arOnPU6qEtFG.kZQy # Non-interactive with --pass flag ./screego hash --name "bob" --pass "secretpassword" # bob:$2a$12$abc123... # Create users file cat > /etc/screego/users << 'EOF' alice:$2a$12$WEfYCnWGk0PDzbATLTNiTuoZ7e/43v6DM/h7arOnPU6qEtFG.kZQy bob:$2a$12$xyz789... EOF ``` -------------------------------- ### Configure TURN Server Source: https://context7.com/screego/server/llms.txt Define the TURN server address, port ranges, and peer restrictions for security. ```bash # TURN server listen address SCREEGO_TURN_ADDRESS=0.0.0.0:3478 # Limit UDP port range for TURN data relay SCREEGO_TURN_PORT_RANGE=50000:55000 # Deny TURN relay to specific CIDRs (security) SCREEGO_TURN_DENY_PEERS=0.0.0.0/8,10.0.0.0/8,127.0.0.1/8,172.16.0.0/12,192.168.0.0/16 ``` -------------------------------- ### Configure Docsify for Screego Source: https://github.com/screego/server/blob/master/docs/index.html Initializes the Docsify configuration object and includes a plugin to dynamically replace GITHUB_VERSION placeholders with the latest tag from the GitHub API. ```javascript const ghVersion = fetch('https://api.github.com/repos/screego/server/tags').then(resp => resp.json()).then(data => data[0].name.slice(1)) window.$docsify = { name: 'screego', repo: 'screego/server', logo: '/logo.png', loadSidebar: true, autoHeader: true, maxLevel: 4, subMaxLevel: 2, plugins: [ function (hook) { hook.afterEach(function (html, next) { ghVersion.then((version) => next(html.replace(/GITHUB_VERSION/g, version))) }) } ] } ``` -------------------------------- ### Configure External TURN Server Source: https://context7.com/screego/server/llms.txt Use an external TURN server instead of the integrated one for distributed deployments. ```bash # External TURN server IP (disables integrated TURN) SCREEGO_TURN_EXTERNAL_IP=turn.example.com # External TURN server port SCREEGO_TURN_EXTERNAL_PORT=3478 # Shared secret for external TURN authentication SCREEGO_TURN_EXTERNAL_SECRET=your-turn-secret ``` -------------------------------- ### Make Screego Binary Executable (Linux) Source: https://github.com/screego/server/blob/master/docs/install.md Command to make the Screego binary executable on Linux systems. This step is not required for Windows. ```bash $ chmod +x screego ``` -------------------------------- ### Run Screego Server with Docker (Port Mapping) Source: https://github.com/screego/server/blob/master/docs/install.md This command runs Screego in Docker, mapping specific ports for network communication. It includes configuration for TURN ports. Note that host network mode is generally recommended. ```bash $ docker run -it \ -e SCREEGO_EXTERNAL_IP=EXTERNALIP \ -e SCREEGO_TURN_PORT_RANGE=50000:50200 \ -p 5050:5050 \ -p 3478:3478 \ -p 50000-50200:50000-50200/udp \ screego/server:GITHUB_VERSION ``` -------------------------------- ### WebSocket Connection Source: https://context7.com/screego/server/llms.txt Establish a WebSocket connection for real-time communication. ```javascript // Connect to WebSocket const ws = new WebSocket('wss://screego.example.com/stream'); ws.onopen = () => { console.log('Connected to Screego'); }; ws.onmessage = (event) => { const message = JSON.parse(event.data); console.log('Received:', message.type, message.payload); }; ws.onerror = (error) => { console.error('WebSocket error:', error); }; ws.onclose = (event) => { console.log('Disconnected:', event.code, event.reason); }; ``` -------------------------------- ### WebSocket API - Creating a Room Source: https://context7.com/screego/server/llms.txt Create a new screensharing room with specified connection mode and settings. ```APIDOC ## WebSocket Message: create ### Description Creates a new screensharing room with specified connection mode and settings. ### Message Format ```json { "type": "create", "payload": { "id": "string", "mode": "stun" | "turn" | "local", "closeOnOwnerLeave": boolean, "username": "string", "joinIfExist": boolean (optional) } } ``` ### Example Usage (JavaScript) Create a room with default settings: ```javascript ws.send(JSON.stringify({ type: 'create', payload: { id: 'my-room-name', mode: 'turn', closeOnOwnerLeave: true, username: 'Alice' } })); ``` Create a room and join if it already exists: ```javascript ws.send(JSON.stringify({ type: 'create', payload: { id: 'existing-room', mode: 'turn', closeOnOwnerLeave: false, username: 'Bob', joinIfExist: true } })); ``` ``` -------------------------------- ### Clone Screego Server Repository Source: https://github.com/screego/server/blob/master/docs/development.md Use this command to clone the Screego server source code from GitHub and navigate into the directory. ```bash git clone https://github.com/screego/server.git && cd server ``` -------------------------------- ### WebSocket Room Management Source: https://context7.com/screego/server/llms.txt Commands for creating and joining rooms via WebSocket. ```javascript // Create room message ws.send(JSON.stringify({ type: 'create', payload: { id: 'my-room-name', mode: 'turn', // 'stun', 'turn', or 'local' closeOnOwnerLeave: true, username: 'Alice' } })); // Create room with auto-join if exists ws.send(JSON.stringify({ type: 'create', payload: { id: 'existing-room', mode: 'turn', closeOnOwnerLeave: false, username: 'Bob', joinIfExist: true } })); ``` ```javascript // Join existing room ws.send(JSON.stringify({ type: 'join', payload: { id: 'my-room-name', username: 'Bob' } })); ``` -------------------------------- ### Apache Configuration: Sub Path with WebSocket Source: https://context7.com/screego/server/llms.txt Configure Apache to serve Screego at a sub-path, including a redirect for the base path and specific proxying for WebSocket and HTTP endpoints. ```apache ServerName example.com SSLEngine on SSLCertificateFile /etc/ssl/certs/example.crt SSLCertificateKeyFile /etc/ssl/private/example.key Keepalive On Redirect 301 "/screego" "/screego/" ProxyPreserveHost On # WebSocket endpoint ProxyPass "/screego/stream" ws://127.0.0.1:5050/stream retry=0 timeout=5 # HTTP endpoints (trailing slash required!) ProxyPass "/screego/" http://127.0.0.1:5050/ retry=0 timeout=5 ProxyPassReverse /screego/ http://127.0.0.1:5050/ ``` -------------------------------- ### Deploy Screego without Host Networking Source: https://context7.com/screego/server/llms.txt Run the server with explicit port mappings. Note that this may cause connectivity issues. ```bash # Run with explicit port mappings (may have connectivity issues) docker run -it \ -e SCREEGO_EXTERNAL_IP=192.168.1.100 \ -e SCREEGO_TURN_PORT_RANGE=50000:50200 \ -p 5050:5050 \ -p 3478:3478 \ -p 50000-50200:50000-50200/udp \ ghcr.io/screego/server:latest ``` -------------------------------- ### User Management - Creating Password Hashes Source: https://context7.com/screego/server/llms.txt Generates bcrypt password hashes for the users file using the built-in hash command. ```APIDOC ## User Management - Creating Password Hashes Use the built-in hash command to generate bcrypt password hashes for the users file. ### Command Examples Interactive password entry: ```bash ./screego hash --name "alice" # Enter Password: ******** # alice:$2a$12$WEfYCnWGk0PDzbATLTNiTuoZ7e/43v6DM/h7arOnPU6qEtFG.kZQy ``` Non-interactive with `--pass` flag: ```bash ./screego hash --name "bob" --pass "secretpassword" # bob:$2a$12$abc123... ``` Example of creating a users file: ```bash cat > /etc/screego/users << 'EOF' alice:$2a$12$WEfYCnWGk0PDzbATLTNiTuoZ7e/43v6DM/h7arOnPU6qEtFG.kZQy bob:$2a$12$xyz789... EOF ``` ``` -------------------------------- ### Apache Configuration: Root Path with WebSocket Source: https://context7.com/screego/server/llms.txt Configure Apache httpd to proxy Screego at the root path, enabling WebSocket support for streaming. ```apache ServerName screego.example.com SSLEngine on SSLCertificateFile /etc/ssl/certs/screego.crt SSLCertificateKeyFile /etc/ssl/private/screego.key Keepalive On ProxyPreserveHost On # WebSocket endpoint ProxyPass "/stream" ws://127.0.0.1:5050/stream retry=0 timeout=5 # HTTP endpoints ProxyPass "/" http://127.0.0.1:5050/ retry=0 timeout=5 ProxyPassReverse / http://127.0.0.1:5050/ ``` -------------------------------- ### WebSocket Screen Sharing Source: https://context7.com/screego/server/llms.txt Initiate screen sharing and handle WebRTC negotiation. ```javascript // Start screen sharing ws.send(JSON.stringify({ type: 'share', payload: {} })); // Then handle WebRTC offer from server ws.onmessage = (event) => { const msg = JSON.parse(event.data); if (msg.type === 'hostoffer') { // Create RTCPeerConnection and handle offer const pc = new RTCPeerConnection({ iceServers: msg.payload.iceServers }); // ... handle WebRTC negotiation } }; ``` -------------------------------- ### HTTP API - Config Endpoint Source: https://context7.com/screego/server/llms.txt Retrieves server configuration and current user state for the UI. ```APIDOC ## GET /config ### Description Retrieves server configuration and current user state for the UI. ### Method GET ### Endpoint /config ### Parameters No parameters are required. Authentication is typically handled via session cookies. ### Request Example ```bash curl -X GET https://screego.example.com/config \ -b cookies.txt ``` ### Response #### Success Response (200) - **authMode** (string) - The authentication mode (e.g., "turn"). - **user** (string) - The currently logged-in username. - **loggedIn** (boolean) - Indicates if a user is logged in. - **version** (string) - The Screego server version. - **roomName** (string) - The name of the current room, if any. - **closeRoomWhenOwnerLeaves** (boolean) - Configuration setting for room behavior. #### Response Example ```json { "authMode": "turn", "user": "alice", "loggedIn": true, "version": "1.10.0", "roomName": "silent-thunder", "closeRoomWhenOwnerLeaves": true } ``` ``` -------------------------------- ### Apache Proxy at Root Path Source: https://github.com/screego/server/blob/master/docs/proxy.md Configure Apache (httpd) to proxy requests to Screego at the root path. Requires mod_proxy, mod_proxy_wstunnel, and mod_proxy_http. Ensure SCREEGO_TRUST_PROXY_HEADERS is enabled. ```apache ServerName screego.example.com Keepalive On # The proxy must preserve the host because screego verifies it with the origin # for WebSocket connections ProxyPreserveHost On # Replace 5050 with the port defined in SCREEGO_SERVER_ADDRESS. # Default 5050 # Proxy web socket requests to /stream ProxyPass "/stream" ws://127.0.0.1:5050/stream retry=0 timeout=5 # Proxy all other requests to / ProxyPass "/" http://127.0.0.1:5050/ retry=0 timeout=5 ProxyPassReverse / http://127.0.0.1:5050/ ``` -------------------------------- ### Extract Screego Server Binary Source: https://github.com/screego/server/blob/master/docs/install.md Command to extract the downloaded Screego server binary archive using tar. ```bash $ tar xvf screego_GITHUB_VERSION_{PLATFORM}.tar.gz ``` -------------------------------- ### HTTP API Server Information Source: https://context7.com/screego/server/llms.txt Endpoints for retrieving server configuration and health status. ```bash # Get server configuration curl -X GET https://screego.example.com/config \ -b cookies.txt # Response: # { # "authMode": "turn", # "user": "alice", # "loggedIn": true, # "version": "1.10.0", # "roomName": "silent-thunder", # "closeRoomWhenOwnerLeaves": true # } ``` ```bash # Health check curl -X GET https://screego.example.com/health # Response when healthy (200): # {"status":"up","clients":5} # Response when unhealthy (500): # {"status":"down","clients":0,"reason":"error message"} ``` -------------------------------- ### Nginx Configuration: Sub Path with WebSocket Source: https://context7.com/screego/server/llms.txt Configure Nginx to serve Screego at a sub-path (e.g., `/screego/`), ensuring correct path rewriting and WebSocket proxying. ```nginx upstream screego { server 127.0.0.1:5050; } server { listen 443 ssl http2; server_name example.com; location /screego/ { rewrite ^/screego(/.*) $1 break; proxy_pass http://screego; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_redirect http:// $scheme://; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto https; proxy_set_header Host $http_host; } } ``` -------------------------------- ### WebSocket API - Joining a Room Source: https://context7.com/screego/server/llms.txt Join an existing room by room ID. ```APIDOC ## WebSocket Message: join ### Description Joins an existing room by room ID. ### Message Format ```json { "type": "join", "payload": { "id": "string", "username": "string" } } ``` ### Example Usage (JavaScript) Join an existing room: ```javascript ws.send(JSON.stringify({ type: 'join', payload: { id: 'my-room-name', username: 'Bob' } })); ``` ``` -------------------------------- ### Nginx Configuration: Root Path with WebSocket Source: https://context7.com/screego/server/llms.txt Configure Nginx to proxy Screego at the root domain, including essential WebSocket headers for proper connection handling. ```nginx upstream screego { server 127.0.0.1:5050; } server { listen 443 ssl http2; server_name screego.example.com; ssl_certificate /etc/ssl/certs/screego.crt; ssl_certificate_key /etc/ssl/private/screego.key; location / { proxy_pass http://screego; proxy_http_version 1.1; # WebSocket support proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_redirect http:// $scheme://; # Proxy headers for IP whitelisting proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto https; # Required: preserve host for WebSocket origin verification proxy_set_header Host $http_host; } } ``` -------------------------------- ### HTTP API Authentication Source: https://context7.com/screego/server/llms.txt Endpoints for logging in and logging out of the Screego server. ```bash # Login with form data curl -X POST https://screego.example.com/login \ -d "user=alice" \ -d "pass=secretpassword" \ -c cookies.txt \ -w "%{http_code}" # Response on success (200): # {"message":"authenticated"} # Response on failure (401): # {"message":"could not authenticate"} ``` ```bash # Logout and clear session curl -X POST https://screego.example.com/logout \ -b cookies.txt \ -w "%{http_code}" # Response (200): session cleared ``` -------------------------------- ### Prometheus Metrics Endpoint Source: https://context7.com/screego/server/llms.txt Retrieve server metrics in Prometheus format, requiring basic authentication. ```bash # Get Prometheus metrics (requires basic auth) curl -X GET https://screego.example.com/metrics \ -u alice:secretpassword # Response: Prometheus text format metrics # screego_rooms_created_total 42 # screego_users_joined_total 156 # ... ``` -------------------------------- ### WebRTC Signaling: Client ICE Candidate Source: https://context7.com/screego/server/llms.txt Send an ICE candidate from the client to establish peer connectivity. Includes session ID, candidate string, and SDP details. ```javascript // Send ICE candidate from client ws.send(JSON.stringify({ type: 'clientice', payload: { sid: 'session-id', candidate: iceCandidate.candidate, sdpMLineIndex: iceCandidate.sdpMLineIndex, sdpMid: iceCandidate.sdpMid } })); ``` -------------------------------- ### WebSocket API - Connecting to WebSocket Stream Source: https://context7.com/screego/server/llms.txt Connect to the WebSocket endpoint for real-time room communication. The `/stream` endpoint handles all room events. ```APIDOC ## WebSocket /stream ### Description Connect to the WebSocket endpoint for real-time room communication. The `/stream` endpoint handles all room events. ### Endpoint wss://screego.example.com/stream ### Connection Example (JavaScript) ```javascript const ws = new WebSocket('wss://screego.example.com/stream'); ws.onopen = () => { console.log('Connected to Screego'); }; ws.onmessage = (event) => { const message = JSON.parse(event.data); console.log('Received:', message.type, message.payload); }; ws.onerror = (error) => { console.error('WebSocket error:', error); }; ws.onclose = (event) => { console.log('Disconnected:', event.code, event.reason); }; ``` ``` -------------------------------- ### WebRTC Signaling: Client Answer Source: https://context7.com/screego/server/llms.txt Send the client's SDP answer after receiving an offer from the host. Requires the session ID and the SDP content. ```javascript // Send client answer after receiving host offer ws.send(JSON.stringify({ type: 'clientanswer', payload: { sid: 'session-id', sdp: rtcSessionDescription.sdp } })); ``` -------------------------------- ### HTTP API - Login Endpoint Source: https://context7.com/screego/server/llms.txt Authenticates a user and receives a session cookie for subsequent requests. ```APIDOC ## POST /login ### Description Authenticates a user and receives a session cookie for subsequent requests. ### Method POST ### Endpoint /login ### Parameters #### Request Body - **user** (string) - Required - The username for authentication. - **pass** (string) - Required - The password for authentication. ### Request Example ```bash curl -X POST https://screego.example.com/login \ -d "user=alice" \ -d "pass=secretpassword" \ -c cookies.txt \ -w "%{{http_code}}" ``` ### Response #### Success Response (200) - **message** (string) - Indicates successful authentication. #### Response Example ```json { "message": "authenticated" } ``` #### Error Response (401) - **message** (string) - Indicates authentication failure. #### Response Example ```json { "message": "could not authenticate" } ``` ``` -------------------------------- ### Nginx Proxy at Root Path Source: https://github.com/screego/server/blob/master/docs/proxy.md Configure Nginx to proxy all requests, including WebSockets, to the Screego server when it's hosted at the root path. Ensure SCREEGO_TRUST_PROXY_HEADERS is enabled. ```nginx upstream screego { # Set this to the address configured in # SCREEGO_SERVER_ADDRESS. Default 5050 server 127.0.0.1:5050; } server { listen 80; # Here goes your domain / subdomain server_name screego.example.com; location / { # Proxy to screego proxy_pass http://screego; proxy_http_version 1.1; # Set headers for proxying WebSocket proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_redirect http:// $scheme://; # Set proxy headers proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto http; # The proxy must preserve the host because screego verifies it with the origin # for WebSocket connections proxy_set_header Host $http_host; } } ``` -------------------------------- ### WebRTC Signaling: Host ICE Candidate Source: https://context7.com/screego/server/llms.txt Send an ICE candidate from the host (screen sharer) to facilitate peer connection. Requires session ID and candidate information. ```javascript // Send ICE candidate from host (screen sharer) ws.send(JSON.JSON.stringify({ type: 'hostice', payload: { sid: 'session-id', candidate: iceCandidate.candidate, sdpMLineIndex: iceCandidate.sdpMLineIndex, sdpMid: iceCandidate.sdpMid } })); ``` -------------------------------- ### HTTP API - Health Endpoint Source: https://context7.com/screego/server/llms.txt Checks server health status and connected client count for monitoring. ```APIDOC ## GET /health ### Description Checks server health status and connected client count for monitoring. ### Method GET ### Endpoint /health ### Parameters This endpoint does not require any parameters. ### Request Example ```bash curl -X GET https://screego.example.com/health ``` ### Response #### Success Response (200) - **status** (string) - The health status of the server (e.g., "up"). - **clients** (integer) - The number of currently connected clients. #### Response Example ```json { "status": "up", "clients": 5 } ``` #### Error Response (500) - **status** (string) - The health status of the server (e.g., "down"). - **clients** (integer) - The number of currently connected clients (often 0 when down). - **reason** (string) - An error message explaining why the server is down. #### Response Example ```json { "status": "down", "clients": 0, "reason": "error message" } ``` ``` -------------------------------- ### HTTP API - Prometheus Metrics Endpoint Source: https://context7.com/screego/server/llms.txt Access Prometheus metrics for monitoring. Requires authentication. ```APIDOC ## GET /metrics ### Description Access Prometheus metrics for monitoring. Requires authentication. ### Method GET ### Endpoint /metrics ### Parameters Requires Basic Authentication. - **Authorization** (string) - Basic Auth header with username and password. ### Request Example ```bash curl -X GET https://screego.example.com/metrics \ -u alice:secretpassword ``` ### Response #### Success Response (200) - **Metrics** (string) - Prometheus text format metrics. #### Response Example ```text screego_rooms_created_total 42 screego_users_joined_total 156 ... ``` ``` -------------------------------- ### Stop Screen Sharing Source: https://context7.com/screego/server/llms.txt Use this WebSocket message to stop an active screen share session. ```javascript // Stop screen sharing ws.send(JSON.stringify({ type: 'stopshare', payload: {} })); ``` -------------------------------- ### HTTP API - Logout Endpoint Source: https://context7.com/screego/server/llms.txt Invalidates the current user session. ```APIDOC ## POST /logout ### Description Invalidates the current user session. ### Method POST ### Endpoint /logout ### Parameters No specific parameters are required in the request body or query. Session is managed via cookies. ### Request Example ```bash curl -X POST https://screego.example.com/logout \ -b cookies.txt \ -w "%{{http_code}}" ``` ### Response #### Success Response (200) Indicates that the session has been cleared. #### Response Example (No specific JSON body mentioned, typically an empty response or a simple confirmation message) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.