TsgcWSPClient_E2EE › Methods › SendDirectMessage
Sends an encrypted direct message (text, stream or bytes) to a remote user.
function SendDirectMessage(const aTo, aText: string): string;
| Name | Type | Description |
|---|---|---|
aTo | const string | UserId of the destination peer as registered on the server. |
aText | const string | Plain text payload. Content is encrypted on this client before being sent. |
Message identifier used to correlate the send with OnE2EEMessageAck. Empty when the message could not be queued (string).
Encrypts aText with the session key agreed with aTo and sends it over the underlying WebSocket. The remote peer receives the decrypted payload through OnE2EEMessageText. If E2EE_Options.Ack.RcvDirectMessage is enabled on the recipient, this side receives OnE2EEMessageAck with the returned identifier.
oE2EE.SendDirectMessage('CLIENT02', 'Hello direct');
function SendDirectMessage(const aTo: string; const aStream: TStream) : string;
| Name | Type | Description |
|---|---|---|
aTo | const string | UserId of the destination peer as registered on the server. |
aStream | const TStream | Stream containing the binary payload. The entire stream content is read and encrypted; position is not preserved. |
Message identifier used to correlate the send with OnE2EEMessageAck. Empty when the message could not be queued (string).
Same as the text overload, but sends binary content from a stream. The recipient receives the decrypted bytes through OnE2EEMessageBinary. Use this form when the payload is already available as a TStream (for example a file or a memory buffer).
oStream := TFileStream.Create('photo.jpg', fmOpenRead);
try
oE2EE.SendDirectMessage('CLIENT02', oStream);
finally
oStream.Free;
end;