@hyperledger/identus-sdk / Exports / ConnectionsManager
Class: ConnectionsManager
ConnectionsManager is responsible of establishing didcomm connection and mediation process with other mediators through didcomm and is also responsible of managing the task to periodically fetch messages from the mediator once connection is established
ConnectionsManager
Table of contents
Constructors
Properties
Accessors
Methods
- addConnection
- awaitMessageResponse
- findIndex
- processMessages
- registerMediator
- removeConnection
- sendMessage
- startFetchingMessages
- startMediator
- stopAllEvents
- stopFetchingMessages
Constructors
constructor
• new ConnectionsManager(agent
, options?
): ConnectionsManager
Creates an instance of ConnectionsManager.
Parameters
Name | Type |
---|---|
agent | Agent |
options? | AgentOptions |
Returns
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:68
Properties
agent
• Private
Readonly
agent: Agent
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:69
cancellable
• Optional
cancellable: CancellableTask
<void
>
Cancellable task used to listen for new messages, stopping the Agent should also stop this from running and destroy the instance of the task until agent is started again
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:45
cancellables
• cancellables: CancellableTask
<any
>[] = []
An array with cancellable tasks, mainly used to store one or multiple didcomm connections in storage implementation at the same time. All of them can be cancelled despite they run asyncronously when the Edge agent stops
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:37
events
• events: AgentMessageEvents
A list of public facing events which will notify the user interface when specific things happen, for now when new messages arrive or didcomm connections are established in order to make UI more reactive
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:54
options
• Optional
options: AgentOptions
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:70
pairings
• pairings: DIDPair
[] = []
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:56
Accessors
mediationHandler
• get
mediationHandler(): MediatorHandler
Returns
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:75
withWebsocketsExperiment
• get
withWebsocketsExperiment(): boolean
Returns
boolean
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:79
Methods
addConnection
▸ addConnection(paired
): Promise
<void
>
Asyncronously add a didPair (didcomm connection) into pluto
Parameters
Name | Type |
---|---|
paired | DIDPair |
Returns
Promise
<void
>
Async
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:185
awaitMessageResponse
▸ awaitMessageResponse(id
): Promise
<undefined
| Message
>
Asyncronously wait for a message response just by waiting for new messages that match the specified ID
Parameters
Name | Type |
---|---|
id | string |
Returns
Promise
<undefined
| Message
>
Async
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:118
findIndex
▸ findIndex(pair
): number
Find the specified did pair connection index
Parameters
Name | Type |
---|---|
pair | DIDPair |
Returns
number
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:209
processMessages
▸ processMessages(unreadMessages?
): Promise
<void
>
Asyncronously process unread messages that are received by either http or websockets didcomm transport This method replaces awaitMessages()
Parameters
Name | Type | Default value |
---|---|---|
unreadMessages | { attachmentId : string ; message : Message }[] | [] |
Returns
Promise
<void
>
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:129
registerMediator
▸ registerMediator(hostDID
): Promise
<void
>
Asyncronously establish mediator with a mediator by providing the Host DID
Parameters
Name | Type |
---|---|
hostDID | DID |
Returns
Promise
<void
>
Async
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:240
removeConnection
▸ removeConnection(pair
): Promise
<void
>
Remove a didPair or a didcomm connection, this does not mean the mediator will do this but just means the connection will be removed from the current storage
Parameters
Name | Type |
---|---|
pair | DIDPair |
Returns
Promise
<void
>
Async
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:226
sendMessage
▸ sendMessage(message
): Promise
<undefined
| Message
>
Asyncronously store a message and send it as didcomm message through the mercury implementation
Parameters
Name | Type |
---|---|
message | Message |
Returns
Promise
<undefined
| Message
>
Async
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:251
startFetchingMessages
▸ startFetchingMessages(iterationPeriod
): Promise
<void
>
Asyncronously start fetching new messages
Parameters
Name | Type |
---|---|
iterationPeriod | number |
Returns
Promise
<void
>
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:262
startMediator
▸ startMediator(): Promise
<void
>
Asyncronously Start the mediator, just checking if we had one stored in Database and setting that one as default during the Agent start
Returns
Promise
<void
>
Async
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:90
stopAllEvents
▸ stopAllEvents(): void
Stops all the running events
Returns
void
Defined in
src/edge-agent/connectionsManager/ConnectionsManager.ts:102
stopFetchingMessages
▸ stopFetchingMessages(): void
Asyncronously stop fetching messages
Returns
void