Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents
maxLevel3

Introduction to Subscriptions

Subscriptions allow two picos to communicate with each other on a secure channel. Subscriptions have several advantages and uses:

...

Subscriptions are formed from two channels from two different Picos. Each channel has a corresponding Eci stored for the other Picos channel. 

 


From each pico's perspective there is an incoming channel and an outgoing channel. The pico receives events and queries from the other pico in the subscriptions over the incoming channel and makes queries and sends events to the other pico using the outgoing channel. 

...

Upon receiving a wrangler:subscription_removal event, the pico deletes the named subscription from the inbound or outbound subscriptions list as appropriate.

Initial Subscription Flow

 

Subscription Approval Flow

Subscription Rejection Flow


Subscription Events

Info

This section mentions getSubscriptions(), which is documented in the last section, Subscription Functions.

Overview

Event Domain

Event Type

Actions

Use

wranglersubscription

creates outbound pending subscription and sends pending_subscription event to external pico

Creates a new outbound pending subscription
wranglerpending_subscriptioncreates inbound pending subscriptionCreates a new inbound pending subscription
wranglerpending_subscription_approvalsends pending_subscription_approved event with inbound_eci and outbound status to external pico and raises pending_subscription_approved with inbound statusAprove inbound pending subscription
wranglerpending_subscription_approvedupdates subscription status and outbound_eci if neededInternally for adding aproved subscriptions
wrangler

subscription_cancellation |

inbound_subscription_rejection |

outbound_subscription_cancellation

sends subscription_removal event with eci and status and raise the same event to selfalert external pico to remove subscriptions and alert self to remove subscription
wranglersubscription_removaldeletes channel used for subscriptioninternally for removing channel used for subscription

Events Users Might Raise

  • wrangler:subscription
  • wrangler:outbound_subscription_cancellation
  • wrangler:inbound_subscription_rejection
  • wrangler:subscription_cancellation
  • wrangler:pending_subscription_approval

Events Users Might React To

  • wrangler:outbound_pending_subscription_added
  • wrangler:inbound_pending_subscription_added
  • wrangler:subscription_removed
  • wrangler:subscription_added

Event Attributes

wrangler:subscription (pico A)

...

Code Block
   { "eci": "cj3n6fe0w0003v8id271a0rlz", // pico B's new eci
     "name": "namespace:name",
     "type": "subscription",
     "verify_key": "GjmSgqkBpAcCkt9H179pqgrQ27zPn336aaNHHHtFspAz",
	 "other_verify_key": "F9S4uC6bZ9pDBZMPeKUHCHrhdMkrTq9GExj8HHtGDTKq",
     "encryption_public_key": "7y9dqgw7KucvYToAguuBP4Shf1cqtnhUF93waBR799e3",
     "other_encryption_public_key": "3cyFiAMRpq1Q4ciEzSoQNzAQHr9voTCu9P46Kyx6qCUz",
     "attributes": 
      { "subscription_name": "name",
        "name_space": "namespace",
        "relationship": "peer 2<->peer 1",
        "my_role": "peer 2",
        "subscriber_role": "peer 1",
        "outbound_eci": "cj3lyamf30003pi0n6u39rsqs",
        "status": "subscribed", // changed
        "attributes: "status",
        "subscriber_host": "http://localhost:8080" } }

Subscription Functions

getSubscriptions

Returns a map from subscription names to subscription objects, or various forms of this map.

...