A lightweight WebSocket-based signaling server for WebRTC applications, built with Swift and Vapor.
This signaling server facilitates WebRTC peer connections by:
- Relaying signaling messages between WebRTC peers
- Managing user presence and connection events
- Handling WebRTC signaling protocol (offers, answers, ICE candidates)
swift build
swift run
The server will be available at http://localhost:8080
.
Connect to the WebSocket endpoint at /signals
to exchange WebRTC signaling data.
The server supports the following event types:
user-joined
: Announces when a new user joinsoffer
: Contains SDP offer for establishing connectionanswer
: Contains SDP answer in response to an offerice-candidate-generated
: Shares ICE candidates for connectionice-candidates-removed
: Notifies when ICE candidates are removed
- Built on Swift Vapor framework
- Uses Swift Concurrency (async/await)
- Utilizes Swift NIO for non-blocking networking
- Actor-based client management for thread safety
Clients should:
- Connect to the WebSocket endpoint
- Announce themselves with a user-joined event
- Listen for other peers joining
- Exchange WebRTC offers/answers and ICE candidates
- Establish direct peer connections once signaling is complete