Created
August 23, 2019 19:54
-
-
Save pedrouid/f25dfd83fbd878ef2c0f1344f35e3993 to your computer and use it in GitHub Desktop.
3Box Threads
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Creating/joining thread in space | |
| const thread = await space.joinThread('orders') | |
| // Others can join by same space and thread name or by thread address | |
| const thread = await space.joinThreadByAddress('/orbitdb/zdpuAp5QpBKR4BBVTvqe3KXVcNgo4z8Rkp9C5eK38iuEZj3jq/3box.thread.pos_bufficorn.orders') | |
| // Post new order in thread | |
| await thread.post({order_id: '123', item_id: '456', amount: '0.0015'}) | |
| // Listen live for new thread posts | |
| thread.onUpdate((entry) => { console.log(entry)}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment