-
Notifications
You must be signed in to change notification settings - Fork 445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Cordova] Cordova + Phonegap TCP Transport #89
Comments
Seems like the APIs are quite different among those plugins and the on that js-libp2p-tcp uses -which is Node's. We can either write a new transport specific for cordova or shim the node api on top of one of those plugins. |
Looks like there is a node api plugin for cordova already - https://github.com/feross/chrome-net :) |
That chrome net is a great find @dryajov. We can actually enable js-ipfs to just take in a whole custom libp2p instance so that runtimes like Cordoba can use the caps they have. @xSkyripper, how does that sound? This shouldn't be hard to make it happen. |
Is this still actual? I'd like to familiarize myself with the whole thing on a deeper level and looking for an entry point. I could try to implement this one. |
Having bridges for native transport and peer discovery support would be great, there still currently isn't any. While there are jvm and swift implementations of libp2p in early phases, there would still need to be bridges built for things like Cordova / React Native. In theory we should be able to use websockets to run things in a browser build, although I don't believe that's been tested in Cordova. @jayarjo if you'd like to look into getting libp2p running in a mobile build that would be a nice tool for mobile app development. I think starting with a browser build of libp2p and integrating in native components as needed, or to enhance the experience would be a good path. |
For now, you can use WebRTC or WebSocket on mobile devices. We're not officially supporting Cordova anytime soon (if community members want to hack it to work, we're happy to review PRs/provide assistance.) |
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Alex Potsides <alex@achingbrain.net>
## [3.0.10](libp2p/js-libp2p-utils@v3.0.9...v3.0.10) (2023-04-18) ### Dependencies * bump it-stream-types from 1.0.5 to 2.0.1 ([libp2p#89](libp2p/js-libp2p-utils#89)) ([0de4a85](libp2p/js-libp2p-utils@0de4a85))
Bumps [p-event](https://github.com/sindresorhus/p-event) from 5.0.1 to 6.0.0. - [Release notes](https://github.com/sindresorhus/p-event/releases) - [Commits](sindresorhus/p-event@v5.0.1...v6.0.0) --- updated-dependencies: - dependency-name: p-event dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
## [8.2.1](libp2p/js-libp2p-peer-store@v8.2.0...v8.2.1) (2023-06-15) ### Trivial Changes * Update .github/workflows/semantic-pull-request.yml [skip ci] ([d38eaf8](libp2p/js-libp2p-peer-store@d38eaf8)) * Update .github/workflows/stale.yml [skip ci] ([9fe80a2](libp2p/js-libp2p-peer-store@9fe80a2)) ### Dependencies * **dev:** bump p-event from 5.0.1 to 6.0.0 ([libp2p#89](libp2p/js-libp2p-peer-store#89)) ([9d96700](libp2p/js-libp2p-peer-store@9d96700))
BREAKING CHANGE: messages are not self emitted by default anymore. You need to set the emitSelf option to true to use it
In the browser, we don't have access to TCP Sockets as we do with nodejs. However, when in cordova/phonegap environment, you have access to a webview for running JS but also a plugin architecture, where you can expose native functionality as a JS API. Hence, there could be a transport written for cordova/phonegap in Android/iOS that enables us to have a nodejs-like js-ipfs instance in a webview.
This would help with developing mobile applications for JS developers.
There are some prior art with this as well, https://www.npmjs.com/package/cordova-plugin-chrome-apps-sockets-tcp comes from Google and exposes a sockets API whose interface can be seen here: https://developer.chrome.com/apps/sockets_tcp
There is also https://github.com/blocshop/sockets-for-cordova
Ideally, the interface exposed by the plugin would be identical to the nodejs interface for sockets, and then https://github.com/libp2p/js-libp2p-tcp could be easily adapted to work.
Existing, similar issues:
ipfs.files.add
callbacks and promises do not resolve on Ionic2 platform - Runtime Support: Ionic Framework ipfs/js-ipfs#802The text was updated successfully, but these errors were encountered: