Put and Get data asynchronously
You have mail!
Sending and receiving data
The next step is to send and receive for this to work we need to get the atKeys file containing the cryptographic keys and login or onboard to the atServer. From there we can put
data and get
data as if a database was local to us but in fact data is remote on the data owners atServer.
This is achieved by every data element having an owner (the sending atSign) and a receiving atSign, behind the scenes the atSDK encrypts the data and sends it on to the atServer for delivery. All we need to do is a simple:
of course we also have to setup the atClient object and onboard but that is all in the at_key_put.dart
file for you. so let's send some data.
Running the program without arguments brings up this help, most is self explanatory.
*Note here we are using the atSigns activated in the previous section just substitute your own atSigns.
The -n
namespace is lefthand side of the atRecord so in this case the full atRecord would be @7capricorn:message.atsign@energetic22
and you see this in the results too. Experiment yourself!
You may also notice yourself that the first time you fail to get the message. This is because we specified in the metadata that the TTL is 60000 millisecond or 1 minute. Try again as you see in the above image and you should get your message too.
The code is worth taking a look at the code as it less than 70 lines but allows data to transferred from a device anywhere to a device anywhere, and the data is fully encrypted.
The data in this example is "store and forward", which is ideal for many use cases but sometimes we need near real time data and that's what we cover next.
Last updated