This is an overview of how agents communicate with each other as compared to regular client/server http connections.
In most applications, the client communicates with the server using http protocol where a request is made to the server and the client awaits the response from the server with a specific timeout after which a timeout exception is raised if we didn’t get any response from server.
On the other hand, agents communicate using DIDComm communication protocols. While protocols have much more to talk about the most important concern here is how the communication flow goes. For the sake of demonstration, lets assume 2 agents want to communicate, Agent Alice and Agent Bob.
- Agent Alice will send a connection request to Agent Bob either directly or through a mediator (another routing agent) using outbound transport
- Agent Bob receives the message (through inbound transport) and process the message
- Agent Bob sends the response in a new request (using outbound TP) sent back to agent Alice
- Agent Alice receives the message through the inbound TP
- Agent Alice process the message (under the hood through Aries) and raises an event with attached data relevant to communication context
- The controller (your app) receives the data using a subscribed callback to the corresponding event types and act upon it
So to wrap things up, as a developer for a controller app that will use the Aries framework you will not worry about most of these scenarios and negotiations going on under the hood. The only thing that you will do as a controller is initiate the connection and wait for an event with specific parameters to be raised to see if the connection succeeded or the specific credential has been received.
From the previous diagrams the normal controller (app) structure would consist of
The main object that holds the core functionalities of the Aries framework.
A callback method passed to the agent event handler to be called on different events such as
- Message received from other agent
- A recent connection with other agent has changed state
- A credential received or has a state changed
Services that will handle the outbound and inbound transports. Remember we mentioned that unlike http request which happens on one channel, the connection here has two ways one outgoing using the outbound transport and one incoming using the inbound transport
Those are the main components that you as a developer will need to care about.