APISending a message

Sending a message

		SendMessage.Done done = new SendMessage.Done() {
			void onSendMessageDone(HashReference messageReference) {
				// Called after sending succeeded

			void onSendMessageFailed(ArrayList<String> errors) {
				// Called if a store could not be accessed, or

		identity.sendMessage(recipient, record, sourceStores, done);
		//new SendMessage(identity, recipient, record, sourceStores, done);
		var done = identity.sendMessage(recipient, record, sourceStores);

		done.onDone = function(messageReference) {
			// Called after sending succeeded

		done.onFailed = function(error) {
			// Called if a store could not be accessed
		my ($hashReference, $storeError) = $identity->sendMessage($recipient, $record, @sourceStores);

		if (defined $storeError) {
			# A store could not be accessed
		} else {
			# Opening and validating the envelope succeeded

Sends record to recipient.

The record is first serialized and encrypted, and then uploaded onto the identity's messaging store. If this succeeds, an envelope pointing to the record is submitted to a recipients messaging store.

If the recipient uses multiple messaging stores, they are tried sequentially in the order listed by the recipient, until one succeeds. If stores fail, it is possible that the recipient receives the exact same envelope on multiple messaging stores.

If the record points to more data, source stores may be provided to copy the referenced content from these source stores to the identity's messaging store. If the referenced objects are part of the identity's private data, the source stores are simply the identity's retrieve stores. For content that has not (yet) be saved, a temporary in-memory store may be created.

identity.sendMessage(recipient, reference, sourceStores, done);
var done = identity.sendMessageFromReference(recipient, reference, sourceStores);
my ($hashReference, $storeError) = $identity->sendMessageFromReference($recipient, $reference, @sourceStores);

As above, but assumes that the message record has already been serialized, encrypted, and put onto one of the source stores (e.g. an in-memory store).