-
Notifications
You must be signed in to change notification settings - Fork 6
ASAPPeer
Thomas Schwotzer edited this page Aug 14, 2021
·
30 revisions
From developers perspective, there are just two relevant methods offered by an ASAP peer:
- an ASAP peer can be asked to deliver a message
- a listener can be informed about incomming messages
Sending a message is not difficult:
static final CharSequence YOUR_APP_NAME = "application/x-yourAppName";
static final CharSequence YOUR_URI = "yourSchema://example";
...
ASAPPeer alicePeer = ...;
byte[] serializedData = "VerySimpleExampleData".getBytes();
// send data
alicePeer.sendASAPMessage(YOUR_APP_NAME, YOUR_URI, serializedData);
// message is stored in the peerPeers can establish a point-to-point connection. We talk about an ASAP Encounter. Peers exchange messages during each encounter. Peers remember their encounter. Message are only sent one time to another peer. This memory is based on the era concept. Developers do not have to deal with this era concept. The following section can be read as just for your information