Exchange SDP

We will explain how the handshake works by establishing a connection between two nodes manually. Let's start two nodes using config1.yaml and config2.yaml, which will make the nodes listen on ports 50000 and 50001 respectively.

# config1.yaml

bind: 127.0.0.1:50000
endpoint_url: http://127.0.0.1:50000
ecdsa_key: <privite key>
ice_servers: stun://stun.l.google.com:19302
stabilize_timeout: 3
external_ip: null
backend: []
data_storage:
  path: /Users/foo/.rings/data2
  capacity: 200000000
measure_storage:
  path: /Users/foo/.rings/measure2
  capacity: 200000000
# config2.yaml

bind: 127.0.0.1:50001
endpoint_url: http://127.0.0.1:50001
ecdsa_key: <private key>
ice_servers: stun://stun.l.google.com:19302
stabilize_timeout: 3
external_ip: null
backend: []
data_storage:
  path: /Users/ryan/.rings/data1
  capacity: 200000000
measure_storage:
  path: /Users/ryan/.rings/measure1
  capacity: 200000000

Handshake !

Launch two nodes:

After that you will see your DID and signature, this signature is used for verify local RPC calling,. E.g.:

Create Offer

Then we ask Node1 to create an offer by:

The output is a complex JSON, which including SDP info and candidates encoded in base58:

Accept Offer and Create Answer

Then we ask Node2 to accept the answer:

Here we will get answer responses by Node 2:

Accept Answer

Finally, we send the answer to Node 1 to finish handshake:

It will respond:

Conclusion

So, as you can see here, the handshake process of the Rings Network can be summarized in 3 steps:

  • 1. Creating an offer and sending it to the other party;

  • 2. Accepting the offer and replying with an answer;

  • 3. Accepting the answer and completing the handshake.

Last updated