functionland / react-native-fula

React (JS/Native) wrapper for go-fula/mobile which creates a bridge between Fula and WNFS for React Native to enable developers create mobile native apps
MIT License
2 stars 5 forks source link

Run fula under a android forgrand service #52

Closed farhoud closed 1 year ago

farhoud commented 1 year ago

on android wrap the FULA client inside service is the better way to run FULA clients this way:

If you need I can make PR. I have done it on a project like this with a more complicated interface.

ehsan6sha commented 1 year ago

@farhoud perfect, a PR for this would be great

farhoud commented 1 year ago

https://github.com/functionland/react-native-fula/pull/54 I started the PR who is working on this currently? @ehsan6sha

ehsan6sha commented 1 year ago

54 I started the PR who is working on this currently? @ehsan6sha

Thank you Farhood. I am the one working on it

farhoud commented 1 year ago

So there are 2 services fula and wnfs. Do they need to run in background? Or they are schedule jobs? Or non they only needed when the app is open?

farhoud commented 1 year ago

Let me share my reason for these question's. Android is limiting background service and added some new task management APIs. There are type of service's which run on its own process and use bridge interface to communicate with activities. So task like streaming data from ui are not suitable for these kind of service's.

And another ting do you need android native notification?

ehsan6sha commented 1 year ago

They are not scheduled jobs. WNFS is responsible for encryption and creating merkle dag from a file, amd fula transfers the created dag to blox. Also whenever user download a file, wnfs requests the needed cids and fula bring them to wnfs from blox and wnfs decrypt .

So to the question:

1- i think if we keep libp2p connection always open, it drains battery and we need to turn it on when application is in foreground (open) and when app is in background or closed, schedule it to turn on and check for updates and then close the connection 2- we need notification which will be on top of fula libp2p but we don't have a notification service yet to blox and back

Did this answer all questions?

farhoud commented 1 year ago

My situation in Hoodchat was pretty much different and I need libp2p to always run. but based on this Documentation I think we can implement upload and download as Jobs and let the android job scheduler handle them:

but bounded service and foreground service are still an option. So @ehsan6sha What do you think we should do?

ehsan6sha commented 1 year ago

Doesn't always running libp2p connection means keeping it open and drains battery?

farhoud commented 1 year ago

Sure big time especially if I enable DHT and hole punching but that's the price of privacy. I don't have a choice I'm waiting on chats, but you have multiple choices.