Skip to content

Instantly share code, notes, and snippets.

@pedrouid
Created August 23, 2019 19:54
Show Gist options
  • Select an option

  • Save pedrouid/f25dfd83fbd878ef2c0f1344f35e3993 to your computer and use it in GitHub Desktop.

Select an option

Save pedrouid/f25dfd83fbd878ef2c0f1344f35e3993 to your computer and use it in GitHub Desktop.
3Box Threads
// 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