6. Connect to a message broker

Next, both accounts will have to be connected to a broker service. To this end, you need an invitation to such a service. At the time of writing, there is no way to obtain an invitation if you haven’t yet received one: MyContexts is still available on an invitation-only base. An invitation is a small json file.

Assuming you have two invitations, use one for each installation. Each invitation will have to match one of your accounts; presumably, the files are named accordingly. You can only use an invitation for a single installation (you can re-use it if you have reset your installation, see: Reset your account).

Start with your first installation, the one you set up for yourself.

6.1. Add the invitation to your installation

An invitation file is a machine-readable description of a context (think of it as a dry-freezed context). The MyContexts menu has an icon that functions as a spot to drop invitations on. It shows as a computer screen with a downward pointing arrow. Hover your mouse above it: a text will pop up that says "Drop an invitation here or press enter/space".

The latter is actually easiest. Click the icon and then press enter. A file selector appears. Navigate to the invitation file that matches the account you work in and select it. A few seconds later, the notification "model:perspectives.domains#BrokerServices added!" will appear (that is, if you have notifications on).

Important
When you receive a context from a peer - whether in the form of an invitation file or through broker service connection - your installation checks if it contains unknown types. If so, it will fetch the model(s) that describe those types and add them to your installation.

Open the section Manage new models and inspect the lower table, to see that a new row has appeared with the title Broker Services.

Next open the section Invitations. It shows a table with two columns and, currently, a single row.

6.2. Cards

Up till now, when opening a context, you did so by clicking a row in a table with a single column. The Invitations table has two columns. The cell in the first column has a background color. Actually, this table cell contains a card. A card represents a role. Often, it can be dragged and dropped (to connect roles, or to remove them, etc). One opens a context by double-clicking the card that represents it.

Double-click the card in the column InviterLastName to open the invitation context. It show three tabs:

  • Inviter

  • Invitee

  • External

Click the Inviter tab. It shows two fields: FirstName and LastName and these identify the person that sent you the invitation. Notice, on the light gray bar below the fields (the tool bar of the form) a rectangle bearing the first name of the inviter. This is the card that represents the inviter. Click the External tab. Here you can read the message that the Inviter sent along with the invitation. Now click the Invitee tab. It,too, shows the fields FirstName and LastName but these are empty. If you were to accept the invitation, your names would appear here.

6.3. Take on a role

In order to illustrate the effect of playing different roles, click the My roles icon in the menu, fetch the role types and see that you play the role "Guest".

Notice (on the Invitee tab) the clipboard icon on the tool bar of the form. Hover the mouse over it. The message that appears hints that you can use this button to fill a role using the clipboard - however, not right now. An explanation is in order: the Invitee tab shows a role form for the Invitee role. Currently, it is not filled. Were there an appropriate role on the clipboard, pressing the button would cause it to fill the Invitee role.

Clearly, in order to become the Invitee, you need to fill it with your own role. This is how to put it on the clipboard:

  • click the Home button (alternatively, browse back to the home screen);

  • click the User and Contacts tab

  • in the role form at the top of this screen, click on the card of its toolbar (the card should sport your first name)

  • then press ctrl-c and watch a small version of the card, colored a bluish green, in the menu bar at the top of the screen. Your card is now on the clipboard!

Move back to the invitation and open the Invitee tab. Notice that the clipboard icon now is in black rather than grey as before: it is now enabled. Click it and the screen is replaced by another. It is still the same context, but by dragging the card you have accepted the role "Invitee" (check it with the 'My Roles' menu item; however, it will show up as AccountHolder, which is a more specialised name in the context of the account of the Brokerservice that you now happen to have). Your perspectives have changed.

This screen shows a lot of information. Most of it is technical detail to do with the actual broker service (e.g. its URL). However, there is a sub-form Administrator that displays the name of the person managing the broker service. This is the first context you’ve seen in which two people actually play a role. Just to remind you: by accepting the role AccountHolder, you have created information that was actually sent to this peer.

You cannot change any of this information, except for the AccountPassword. Don’t do it, though: you would lose the ability to connect to the broker service. In a future version of the model you’ll be able to change your password (and that version will be strictly private, so that even the Administrator can no longer access your account on the broker server).

6.4. Activate the broker service

The broker service activates when you start your installation. To that end, you’ll have to restart. There is, in fact, not a button to sign out of exit MyContexts.Just refresh the browser window, it will do the trick. However: if you do so, the browser will display an alert with a text that warns you that changes may not be saved (the actual text depends on the browser, it cannot be customised). Actually, that will not happen, as all changes are saved immediately.

Important
You should not navigate away from the MyContexts page (by closing the tab, entering a different url, reloading the page) while a context is open. This is because being-displayed-on-the-screen is a context property that is available to the modeller. She can use it to notify peers, for example, when you open a context. Navigate away with a context open and peers will never know you’ve left. Instead, use the exit button (largish left bracket with an arrow pointing right) to close the context, then navigate away.

Close the context, reload the page. Enter your user name. Notice that after a short time interval, a new symbol appears on the right of the menu bar, signalling that you are connected to the broker service.

6.5. Rinse and repeat

Now switch over to the window with the other Chrome profile ("test1"). Repeat the procedure above, that is:

  • upload the other invitation;

  • accept the AccountHolder role in the invitation context;

  • exit the context and restart MyContexts by refreshing the window.