[英]“POST http://localhost:9090/spawn ERR_CONNECTION_REFUSED” error while spawning an IPFS daemon using ipfsd-ctl
I'm trying to Spawn an IPFS daemon from the Browser using the provided remote endpoint using the ipfsd-ctl library.我正在尝试使用提供的远程端点使用 ipfsd-ctl 库从浏览器生成 IPFS 守护程序。
This is the link I'm referring这是我指的链接
// Start a remote disposable node, and get access to the api // print the node id, and stop the temporary daemon const Ctl = require('ipfsd-ctl') const port = 9090 const server = Ctl.createServer(port, { ipfsModule: require('ipfs'), ipfsHttpModule: require('ipfs-http-client') }, { js: { ipfsBin: 'path/js/ipfs/bin' }, go: { ipfsBin: 'path/go/ipfs/bin' }, }) const factory = Ctl.createFactory({ ipfsHttpModule: require('ipfs-http-client'), remote: true, endpoint: `http://localhost:${port}` // or you can set process.env.IPFSD_CTL_SERVER to http://localhost:9090 }) await server.start() const ipfsd = await factory.spawn() const id = await ipfsd.api.id() console.log(id) await ipfsd.stop() await server.stop()
It shows a "Server not implemented in the browser" warning and "POST http://localhost:9090/spawn net::ERR_CONNECTION_REFUSED" error它显示“服务器未在浏览器中实现”警告和“POST http://localhost:9090/spawn net::ERR_CONNECTION_REFUSED”错误
Ctl.createServer starts an HTTP Server that Ctl.createFactory will connect to. Ctl.createServer 启动 Ctl.createFactory 将连接到的 HTTP 服务器。 As the warning says "Server not implemented in the browser", you need to run it in nodejs and from the browser use Ctl.createFactory to interact with it.
正如警告所说“服务器未在浏览器中实现”,您需要在nodejs中运行它,并从浏览器使用 Ctl.createFactory 与之交互。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.