Skip to content

Architecture and protocol review

Now that you've seen the system in action, let's review and visualize the architecture and the protocol that the clients and service followed when performing those tasks.

I suppose you're programmed for architecture and protocol.

Note

To keeps things simple I've only mentioned paths and relations that the client used in the steps you took under Run the clients. There are more paths and relations offered by the service.

Architecture (v1)

  • The backend architecture for Event Buddy v1 is a single component.
  • The component is hosted at http://localhost:2112.
  • The whole URL space is within that domain
    • i.e. all resource URLs begin with http://localhost:2112

  • The bob client uses knowledge of the URL structure when building paths
    • including when relating one resource to another (/parent/{parent_id/child, e.g. /venues/{venue_id}/events)
    • It also knows which field in a resource is used as the ID when constructing these paths
  • The alice client is configured only with the knowledge of the single URL, and the link relations it will need.

Protocol

Looking only at the scripted steps the prior sections walked you through, the protocol between client and service can be shown as this:

Note

References to code in the following are pseudocode for brevity.

StepDescription
1You started the client application by running meeting_buddy.py
2Client sent a GET request for the root resource.
alice only
  root = Api.get_root_resource()
3Client sent a GET request for all venues, calling the static method Venue.select_venue()
alice:
  url = Api.url_from_resource(root, 'venues')->GET
bob:
  url = Api.url_join(BASE_API_URL, '/venues')->GET
4Client now has an array of venues in memory, and uses it to display a menu for you to choose from.
5You selected the first venue. The client indexes the array, referencing the venue you chose.
6Client sends a GET request for all events that belong to that venue by calling venue.get_events().
alice:
  url = Api.url_from_resource(venue, 'events')->GET
bob:
  url = Api.url_join(BASE_API_URL, f'/venues/{venuef["_id"]}/events')->GET
7Client now has an array of events in memory, and uses it to display a menu for you to choose from.
8You selected V for View, then chose the first event. The client indexes the array, referencing the event you chose.
9Client called event.view_attendees()
alice:
  url = Api.url_from_resource(event, 'registrations')->GET
bob:
  url = Api.url_join(BASE_API_URL, f'/events/{event["_id"]}/registrations')->GET
10Client now has a list of registrations (with embedded account information) and displays the names of the attendees.
11You entered A for Add, then entered the event details.
12Client tells the venue to send a POST request with its body containing the event details: venue.add_event(event).
alice:
  url = Api.url_from_resource(venue, 'events')->POST event
bob:
  url = Api.url_join(BASE_API_URL, f'/venues/{venue["_id"]}/events')->POST event

Released under the MIT License.

Released under the MIT License.