MessageSender

public class MessageSender

Manage sending messages

  • Transmit a Sendable (i.e., a message) to a list of MessageRecipient (specific devices and/or users’ whole collections of devices)

    Note: References to self (our specific .device, or all of our devices in the case of our .user) are ignored in the list of recipients.

    Declaration

    Swift

    public func send(_ sendable: Sendable, to recipients: [MessageRecipient] = [], syncToSelf: Bool = true) -> Promise<[TransmissionInfo]>

    Parameters

    sendable

    the Sendable message

    recipients

    the list of recipients (optional) – empty means only send sync to self

    syncToSelf

    whether or not to sync to our other devices (defaults to true)

    Return Value

    a Promise<[TransmissionInfo]> with information about the transmission to each of the recipients

  • Send a sync message of a list of SyncReadReceipt to our other devices to indicate specific messages having been read.

    Declaration

    Swift

    public func sendSyncReadReceipts(_ receipts: [SyncReadReceipt]) -> Promise<TransmissionInfo>

    Parameters

    receipts

    the list of read-receipts for messages from others

    Return Value

    a Promise<TransmissionInfo> indicating the success of the transmission