How to build apps that need to respond to events when user is offline and not running app

I’m trying to break free of my client/server thinking.
One of the good things about talking with servers is that you can (kind of) rely on them to be on 24/7. If my app only runs when I execute it on my machine aren’t there a whole lot of things I can’t do because my machine is off and not running apps.

Let’s say I want to build an agent to buy something on Amazon for me, but only if the price goes below $100 (and purchase immediately in case it goes back up). If I don’t keep my app running 24/7 then it would never find out.

How to approach this kind of problem in MaidSafe?

You could go to a P2P market on SAFE and pay someone (whoever offers the lowest price) to buy that stuff for you.
That’s what purse.io does with bitcoin.

The application (web shop sniping) has nothing to do with Amazon (or SAFE) per se, as far as I can tell.
It’s like asking how would one use Tor to save a file to your home NAS. Tor is not meant for that kind of stuff so he shouldn’t.

2 Likes

I’m trying to tinker with this as we speak for simple purposes, viewer counts and many other functions become difficult by nature. This will be a very important topic!

You will need code to run somewhere, so this kind of operation either needs support for network compute / smart contract features (planned later) or as @janitor suggests, using a third party service.

2 Likes

Point blank, if you’re not connected to the Network, your apps can’t operate on the Network.

  • You can recieve messages via mpid_messaging, but you can’t act on them - they’re stored encrypted on the node responsible for them.
  • You can have a daemon/cron job periodically connect to the Network and check, but that’s not constant.
  • Even when the Network receives computational ability, it’ll be more akin to a CPU rather than RAM - so it won’t be able to initiate the execution of code for you.

But what @happybeing said about smart contract features does indeed sound more along the lines of what you’re looking for. A little like RAM now that I think about it. Which would require computational ability. So this may just not be an issue that we will be able to solve until version 3.0.

Rome wasn’t built in a day.
Phillippe of Alsace, the Count of Flanders (<-- I had to look that one up)

2 Likes

How about something as small as updating a variable to publicly accessible resources of a service? or holding a database of any kind for other users to access publicly, if my app is connected to the network?

To answer your question, flip it around:

Safe net requires a different way of designing applications. The old client/server model doesn’t really work.

I would suggest thinking how you could:

  • Store public data directly into the safe network (essentially, a large nosql database) and access it via the client directly (e.g. javascript on browser).
  • Consider how some data could accessible by different groups of people, who could then have different views of the data and allow different sets of changes to be made.
  • Where server side processing is absolutely needed, monitor for updates to your data and respond to them. This could be on traditional server infrastructure, but also even your phone (in future) or anywhere else have can permanently connect.

Essentially, the clients should do as much heavy lifting as possible, including database access.

1 Like

So essentially, I can and should have apps that run 24/7 either on a pc I’ve put in the attic or later on my phone. These can then act as personal agents to do whatever.

In the Amazon example, Amazon or some other service would keep updating a public source of item/price data. My client app would be installed on my ‘always on’ home computer, it would subscribe to another service for price updates and receive mpid messages for things of interest, upon which it could act in a preconfigured way.

I could either run a price update service locally just for me, or as service for others. It would monitor the public price data, accept subscriptions to deltas and send messages to clients. There might me multiple copies of this same service running at anyone time, potentially allowing load balancing based upon client distance…

The creator of the public price data would be rewarded due to lots of gets on this source. Same for the creator of the monitoring service app. How would those who run the service get rewarded?

1 Like

Yup. Just run your PC 24/7.

Build a dirty hack script that sends you a text message when item goes on a sale.

From there, you could ssh tunnel from your phone to your PC, and run the script to buy the item. Or run safenet on your phone, and buy it.