Blockchain (8): p2p decentralized websocket server implements business logic

1 Business logic

For example, peer1 and peer2 communicate with each other

peer1 sends the message "I want the latest block" to peer2 through onopen{ write(Mesage(QUERY_LATEST))}.

peer2 receives the message through onMessage and processes the message through the handleMessage method.

handleMessage is processed according to the message type

RESPONSE_BLOCKCHAIN: Return to the blockchain. RESPONSE_BLOCKCHAIN ​​processing enters handleBlockChainResponse(receivedLatestBlock). The latest block returned is the latest block in my local area.

Guess you like

Origin blog.csdn.net/u013938578/article/details/133471632