Right now I have this functionality in my p2p app.
- get IP from the config file.
- make the host
- connect to each peer
a. make connection object
i. receiveMessageCycle
periodically read from inbound stream and check if :
aa. if message type message: call handler to check message type
bb. signature: handlesignature
cc. getPeerReply:: peer_service.updatePeerList: for each new peer setup connection
ii. sendMessageCycle:
aa. deque from the message queue.
bb. Make a frame and put the message and its type as a message.
cc. Put it to outbound stream.
iii. sendPeersCycle:
aa. call peer_service.getPeers: take connections and iterate to get the public key, id, adds in arr
bb. Make a frame and put arr and message type as getpeerReply
cc. put the frame to the outbound stream.
Now I want to have a different parallel network apart from this. The main goal for this is to optimize the message sharing for the connected peers.