Module signal

Module signal 

Source
Expand description

§The signalling server implementation

This structure implements a signalling server. It communicates using WSSignalMessageToNode and WSSignalMessageFromNode messages with the nodes.

§Node connection to the signalling server

If a node wants to connect to the signalling server, it needs to prove it holds the private key corresponding to its public key by signing a random message sent by the signalling server:

§WebRTC signalling setup

Once a node has been connected to the signalling server, other nodes can start a WebRTC connection with it. For this, the nodes will send several WSSignalMessageFromNode::PeerSetup messages that the signalling server will redirect to the other node. These messages contain the PeerInfo and the [crate::web_rtc::messages::PeerMessage] needed to setup a WebRTC connection. One of the nodes is the initializer, while the other is the follower:

  • Initializer sends a [crate::web_rtc::messages::PeerMessage::Init] to the follower
  • The follower answers with a [crate::web_rtc::messages::PeerMessage::Offer] containing information necessary for the setup of the connection
  • The initializer uses the offer to start its connection and replies with a [crate::web_rtc::messages::PeerMessage::Answer], also containing information for the setting up of the connection

Once the first message has been sent, both nodes will start to exchange [crate::web_rtc::messages::PeerMessage::IceCandidate] messages which contain information about possible connection candidates between the two nodes. These messages will even continue once the connection has been setup, and can be used for example to create a nice handover when the network connection changes.

After the connections are set up, only the IceCandidate messages are exchanged between the nodes.

§Usage of the signalling server

You can find an example of how the signalling server is used in https://github.com/ineiti/fledger/tree/0.7.0/cli/flsignal/src/main.rs

Structs§

FledgerConfig
MessageAnnounce
What a node sends when it connects to the signalling server
NodeStat
Some statistics about the connections to other nodes.
SignalConfig
SignalServer
This implements a signalling server. It can be used for tests, in the cli implementation, and will also be used later directly in the network struct to allow for direct node-node setups.

Enums§

SignalIn
Messages for the signalling server
SignalOut
Messages sent by the signalling server to an eventual listener
WSSignalMessageFromNode
A message coming from a node
WSSignalMessageToNode
Message is a list of messages to be sent between the node and the signal server.

Constants§

SIGNAL_VERSION
Our current version - will change if the API is incompatible.

Type Aliases§

BrokerSignal