#p2p #web-rtc #communication #signal

bin+lib webrtc-signal-server

General WebRTC signal server For Peer to Peer Communication

2 releases

Uses new Rust 2024

new 0.1.1 May 8, 2025
0.1.0 May 8, 2025

#351 in WebSocket

MIT/Apache

11KB
132 lines

webrtc-signal-server

A general WebRTC signal server for peer-to-peer communication, written in Rust and powered by async networking and WebSockets.

Features

  • Simple WebSocket-based signaling for WebRTC peers
  • Peer registration and discovery
  • Message relay between peers
  • Asynchronous, scalable, and easy to deploy

Usage

Add to your workspace or build as a standalone binary:

cargo build --release

Run the server (default port: 9000):

cargo run --release

The server listens for WebSocket connections on 0.0.0.0:9000.

Protocol

Clients communicate with the server using JSON messages:

Register

{ "type": "register", "peer_id": "your-unique-id" }

List Peers

{ "type": "list_peers" }

Relay Message

{ "type": "relay", "to": "target-peer-id", "data": { ... } }

Server Responses

  • List of peers:
    { "type": "peers", "peers": ["peer1", "peer2"] }
    
  • Relayed message:
    { "type": "relay", "from": "peer1", "data": { ... } }
    
  • Error:
    { "type": "error", "error": "description" }
    

License

MIT OR Apache-2.0

Repository

https://github.com/stars-labs/cypto-rust-tools

Dependencies

~4–12MB
~116K SLoC