websocket-relay/README.md
savinmax 9ad38190a5
All checks were successful
Release / release (push) Successful in 19s
CI / test (push) Successful in 9s
CI / lint (push) Successful in 12s
adding config-file arg
2025-08-02 21:31:35 +02:00

732 B

WebSocket Relay Server

A minimal Go WebSocket relay server with SSL support for P2P connections.

Setup

go mod tidy
# Configure via config.yaml (see config.yaml for options)
go run main.go --config-file=./config.yaml

Configuration

Edit config.yaml to configure:

  • Server port and TLS settings
  • SSL certificate paths

Usage

  • WebSocket endpoint: /
  • All WebSocket messages are relayed to all connected clients

Testing

// For TLS enabled (default config)
const ws = new WebSocket('wss://localhost:8443/');
// For HTTP only
// const ws = new WebSocket('ws://localhost:8443/');
ws.onmessage = (event) => console.log('Received:', event.data);
ws.send('Hello from client!');