CONUN DECENTRALIZED NETWORK (P2P)
This is conun-p2p-network module for implementing to Node.js
This project is still in Alpha, lots of development is happening, API might change. The documentation in the master branch may contain changes from a pre-release. If you are looking for the documentation of the latest release, you can view the latest release on npm.
You can use npm to install dependencies, to do;
| NPM | |
|---|---|
npm install @CONUN-Global/conun-p2p-network |
That's it!
Network Configuration
CONUNP2P.Config.createNode({server: 'BOOT_SERVER_IP', address: 'BOOT_PEER_ADDRES'}, 'SWARM_KEY')Define Interfaces Type:
- ProtocolIO - protocol
- TopicIO - router
router = new CONUNP2P.TopicIO(p2p)
protocol = new CONUNP2P.ProtocolIO(p2p)Protocol Type: protocol | Method: Listener
- protocol.link (url/content/jobId)
- res(from, message, event)
await protocol.link(`/p2p/protocol/0.0.1/${content}/${jobID}`, (res) => {
''' your code here'''
})Protocol Type: protocol | Method: Send
- protocol.push (url/content/jobId, event, message)
protocol.push(`/p2p/protocol/0.0.1/${content}/${jobID}`, 'event-name', 'message')Protocol Type: protocol | Method: Send (send message direct to destination (p2p) )
- protocol.pin (url/content/jobId, event, destination_peer_id, message)
- res(from, message, event)
await protocol.pin(`/p2p/protocol/0.0.1/${content}/${jobID}`, '', 'destination_peer_id', 'message')Protocol Type: Router | Method: link ( get message from subscribed endpoint)
- router.link (url/content/jobId, callback(response))
- res(from, message, event)
router.link(`/p2p/router/1.0.0/${content}/${jobID}`, (res) => {
''' your code here'''
})Protocol Type: Router | Method: link ( get message from subscribed endpoint)
- router.link (url/content/jobId, callback(response))
- res(from, message, event)
router.push(`/p2p/router/1.0.0/${content}/${jobID}`, 'event-name', 'message')Ask from Developers Discord
Released since 2021.02.22