SessionInit
message, and waiting to receive the SessionAck
message back. The first SessionInit
message is expected to be sent by the initiator.SessionInit
message.peer_pub_key
should match the destination node's public keynode_pub_key
should match the sender node expected public key (relevant for the initiator node only since he already knows the recipient node's identity)sign
should be a valid secp256k1 signature over the sha256 hash of a JSON-serialized msg containing fields 3-7SessionInit
message are valid, the receiver replies with a SessionAck
message. If a SessionAck
message is not received within a reasonable time frame (10 seconds is recommended), the sender may disconnect.SessionInit
message (Bob) has generated his ECDH keys, he can calculate the shared key by using the ephemeral_pub_key
from the SessionInit
message. Once the SessionAck
message is received by the sender of the SessionInit
message (Alice), she can compute the shared key as well. All future communication from Alice to Bob must be encrypted with aes-256-cbc symmetric encryption using the shared key.Ping
and Pong
messages.Ping
message every 30 seconds.Ping
message may disconnect if a Pong
message is not received within 10 seconds.Pong
message is sent in response to the Ping
message. It serves to keep the connection alive by explicitly notifying the other end that the receiver is still active.Disconnecting
message is used to inform a connected peer that a disconnection is imminent and that the peer should disconnect immediately. A well-behaved host that sends a Disconnecting
message allows the peer at least 2 seconds to disconnect before disconnecting itself.reason
is an optional parameter for specifying one of the following reasons for the disconnection:0x01
0x02
0x03
0x04
0x05
0x06
0x07
0x08
0x09
0x0a
0x0b
0x0c
0x0d
GetNodes
message is used to query a peer for its list of known, reachable OpenDEX nodes.Nodes
message is used to respond to the GetNodes
message.NodeStateUpdate
message is used to tell a peer about a change in the node state. An example of an update is the removal or addition of a supported trading pair.