DIDComm.sendDIDCommMessage() method
This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Sends the given message to the recipient. If a return-transport is provided it will be checked whether the parent thread allows reusing the route. You cannot reuse the transport if the message was forwarded from a DIDComm mediator.
Emits an eventType 'DIDCommV2Message-sent' that contains the message id of packed DIDComm message IPackedDIDCommMessage after the message was sent.
Signature:
sendDIDCommMessage(args: ISendDIDCommMessageArgs, context: IAgentContext<IDIDManager & IKeyManager & IResolver & IMessageHandler>): Promise<ISendDIDCommMessageResponse>;
Parameters
Parameter | Type | Description |
---|---|---|
args | ISendDIDCommMessageArgs | An object containing the message, recipient information and optional information about the transport that should be used. |
context | IAgentContext<IDIDManager & IKeyManager & IResolver & IMessageHandler> | This method requires an agent that also has IResolver, IKeyManager, IDIDManager, and IMessageHandler plugins in use. When calling this method, the context is supplied automatically by the framework. |
Returns:
Promise<ISendDIDCommMessageResponse>
- a ISendDIDCommMessageResponse containing the transport id that was used to send the message and a return message, if one is available. It throws an error in case something went wrong.
This API may change without a BREAKING CHANGE notice.