Used for negotiations of WebRTC channel between Connector Extension or headless radix connect and Radix Wallet. Its client is implemented in radix-connect-webrtc inside SignalingClient or in babylon ios wallet example
The server uses a distributed architecture where multiple instances can run simultaneously, communicating through Redis pub/sub. This allows for:
- Horizontal scalability
- High availability
- Load balancing
- Session persistence
- WebRTC Offers
- WebRTC Answers
- ICE Candidates
- Connection status updates
sequenceDiagram
participant Client1 as Client 1 (Wallet)
participant SS as Signaling Server
participant Redis as Redis PubSub
participant Client2 as Client 2 (Extension)
Note over Client1,Client2: Client 1 connects first
Client1->>SS: WS Connect (connectionId, source=wallet, target=extension)
SS->>Redis: Set data (connectionId:extension, clientId1)
SS->>Redis: Subscribe to clientId1 channel
SS-->>Client1: Connection established
Note over Client1,Client2: Client 2 connects later
Client2->>SS: WS Connect (connectionId, source=extension, target=wallet)
SS->>Redis: Get data (connectionId:wallet)
SS->>Redis: Set data (connectionId:wallet, clientId2)
SS->>Redis: Subscribe to clientId2 channel
Note over SS: Found existing client
SS->>Redis: Publish to clientId1 {"info": "remoteClientJustConnected"}
SS-->>Client2: {"info": "remoteClientIsAlreadyConnected"}
Redis-->>Client1: {"info": "remoteClientJustConnected"}
Note over Client1,Client2: Channel established, ready for WebRTC signaling
yarn install
You'll need docker installed on your machine to run this!
docker-compose build
make up
make up-test
- run two local Signaling Server instances and redis instance
yarn test
- execute tests
make up-build
make logs
make down
make up-prod