Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

API sugar: start, listen, and connect #1084

Closed
pgte opened this issue Nov 17, 2017 · 1 comment
Closed

API sugar: start, listen, and connect #1084

pgte opened this issue Nov 17, 2017 · 1 comment
Assignees
Labels
exploration kind/resolved-in-helia P2 Medium: Good to have, but can wait until someone steps up status/ready Ready to be worked

Comments

@pgte
Copy link
Contributor

pgte commented Nov 17, 2017

Doing user-land apps and modules on top of IPFS, there are some oddities that I would love to see addressed to make life easier to developers.

One of them is starting a node, also related to offline support:

Creating a node and starting it should be easy to achieve even if offline. Starting a node should not mean initialising the network stack. It just means that you have a node you can read and write DAG nodes to and from. Also, it should mean that all the APIs are available. For instance, after starting, the pubsub API should be ready, even if subscriptions are only effective if the node is connected.

I would like to be able to do:

const node = IPFS()
await node.start() // initialises repo, makes all the APIs ready for commands

// pubsub is available
await node.pubsub.subscribe('topic', handler)

// can listen on a protocol (like webrtc) or an address (like a websockets server)
await node.listen(address, options) // listens on an address / protocol

// try to connect to a specific node
try {
  const duplexStream = await node.connect(peerAddress, protocol)
} catch (err) {
  if (err.code === 'ECONNECT') {
    console.log('could not connect to ' + peerAddress)
  }
}

// stops node and all network activity
await node.stop()
@pgte pgte changed the title API sugar: start, listen, discover and connect API sugar: start, listen, and connect Nov 17, 2017
@daviddias daviddias added status/ready Ready to be worked exp/wizard Extensive knowledge (implications, ramifications) required P2 Medium: Good to have, but can wait until someone steps up status/deferred Conscious decision to pause or backlog exploration and removed exp/wizard Extensive knowledge (implications, ramifications) required status/ready Ready to be worked labels Jan 25, 2018
@daviddias daviddias added status/ready Ready to be worked and removed status/deferred Conscious decision to pause or backlog labels Dec 9, 2018
MicrowaveDev pushed a commit to galtproject/js-ipfs that referenced this issue May 22, 2020
Test on Node.js 12 and also utilise cache.

License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
@SgtPooki SgtPooki moved this to 🥞 Todo in js-ipfs deprecation May 17, 2023
@whizzzkid whizzzkid moved this from 🥞 Todo to 🛑 Blocked in js-ipfs deprecation May 24, 2023
@whizzzkid
Copy link

whizzzkid commented May 31, 2023

js-ipfs is being deprecated in favor of Helia. You can follow the migration plan here #4336 and read the migration guide.

This issue has been resolved in Helia! if this does not address your concern please let us know by reopening this issue before 2023-06-05!

@github-project-automation github-project-automation bot moved this from 🛑 Blocked to ✅ Done in js-ipfs deprecation May 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
exploration kind/resolved-in-helia P2 Medium: Good to have, but can wait until someone steps up status/ready Ready to be worked
Projects
No open projects
Status: Done
Development

No branches or pull requests

3 participants