Package version:

The client to do chat operations

Hierarchy

  • ChatClient

Constructors

  • Creates an instance of the ChatClient for a given resource and user.

    Parameters

    • endpoint: string

      The url of the Communication Services resource.

    • credential: CommunicationTokenCredential

      The token credential. Use AzureCommunicationTokenCredential from @azure/communication-common to create a credential.

    • options: ChatClientOptions = {}

      Additional client options.

    Returns ChatClient

Methods

  • Deletes a chat thread.

    Parameters

    • threadId: string

      The ID of the thread to delete.

    • options: OperationOptions = {}

      Operation options.

    Returns Promise<void>

  • Unsubscribe from chatMessageReceived.

    Parameters

    • event: "chatMessageReceived"

      The ChatMessageReceivedEvent.

    • listener: ((e: ChatMessageReceivedEvent) => void)

      The listener to handle the event.

        • (e: ChatMessageReceivedEvent): void
        • Parameters

          • e: ChatMessageReceivedEvent

          Returns void

    Returns void

  • Unsubscribe from chatMessageEdited.

    Parameters

    • event: "chatMessageEdited"

      The ChatMessageEditedEvent.

    • listener: ((e: ChatMessageEditedEvent) => void)

      The listener to handle the event.

        • (e: ChatMessageEditedEvent): void
        • Parameters

          • e: ChatMessageEditedEvent

          Returns void

    Returns void

  • Unsubscribe from chatMessageDeleted.

    Parameters

    • event: "chatMessageDeleted"

      The ChatMessageDeletedEvent.

    • listener: ((e: ChatMessageDeletedEvent) => void)

      The listener to handle the event.

        • (e: ChatMessageDeletedEvent): void
        • Parameters

          • e: ChatMessageDeletedEvent

          Returns void

    Returns void

  • Unsubscribe from typingIndicatorReceived.

    Parameters

    • event: "typingIndicatorReceived"

      The TypingIndicatorReceivedEvent.

    • listener: ((e: TypingIndicatorReceivedEvent) => void)

      The listener to handle the event.

        • (e: TypingIndicatorReceivedEvent): void
        • Parameters

          • e: TypingIndicatorReceivedEvent

          Returns void

    Returns void

  • Unsubscribe from readReceiptReceived.

    Parameters

    • event: "readReceiptReceived"

      The ReadReceiptReceivedEvent.

    • listener: ((e: ReadReceiptReceivedEvent) => void)

      The listener to handle the event.

        • (e: ReadReceiptReceivedEvent): void
        • Parameters

          • e: ReadReceiptReceivedEvent

          Returns void

    Returns void

  • Unsubscribe from chatThreadCreated.

    Parameters

    • event: "chatThreadCreated"

      The ChatThreadCreatedEvent.

    • listener: ((e: ChatThreadCreatedEvent) => void)

      The listener to handle the event.

        • (e: ChatThreadCreatedEvent): void
        • Parameters

          • e: ChatThreadCreatedEvent

          Returns void

    Returns void

  • Unsubscribe from chatThreadDeleted.

    Parameters

    • event: "chatThreadDeleted"

      The ChatThreadDeletedEvent.

    • listener: ((e: ChatThreadDeletedEvent) => void)

      The listener to handle the event.

        • (e: ChatThreadDeletedEvent): void
        • Parameters

          • e: ChatThreadDeletedEvent

          Returns void

    Returns void

  • Unsubscribe from chatThreadPropertiesUpdated.

    Parameters

    • event: "chatThreadPropertiesUpdated"

      The ChatThreadPropertiesUpdatedEvent.

    • listener: ((e: ChatThreadPropertiesUpdatedEvent) => void)

      The listener to handle the event.

        • (e: ChatThreadPropertiesUpdatedEvent): void
        • Parameters

          • e: ChatThreadPropertiesUpdatedEvent

          Returns void

    Returns void

  • Unsubscribe from participantsAdded.

    Parameters

    • event: "participantsAdded"

      The ParticipantsAddedEvent.

    • listener: ((e: ParticipantsAddedEvent) => void)

      The listener to handle the event.

        • (e: ParticipantsAddedEvent): void
        • Parameters

          • e: ParticipantsAddedEvent

          Returns void

    Returns void

  • Unsubscribe from participantsRemoved.

    Parameters

    • event: "participantsRemoved"

      The ParticipantsRemovedEvent.

    • listener: ((e: ParticipantsRemovedEvent) => void)

      The listener to handle the event.

        • (e: ParticipantsRemovedEvent): void
        • Parameters

          • e: ParticipantsRemovedEvent

          Returns void

    Returns void

  • Subscribe function for chatMessageReceived. The initial sender will also receive this event. You need to call startRealtimeNotifications before subscribing to any event.

    Parameters

    • event: "chatMessageReceived"

      The ChatMessageReceivedEvent.

    • listener: ((e: ChatMessageReceivedEvent) => void)

      The listener to handle the event.

        • (e: ChatMessageReceivedEvent): void
        • Parameters

          • e: ChatMessageReceivedEvent

          Returns void

    Returns void

  • Subscribe function for chatMessageEdited. The initial sender will also receive this event.

    Parameters

    • event: "chatMessageEdited"

      The ChatMessageEditedEvent.

    • listener: ((e: ChatMessageEditedEvent) => void)

      The listener to handle the event.

        • (e: ChatMessageEditedEvent): void
        • Parameters

          • e: ChatMessageEditedEvent

          Returns void

    Returns void

  • Subscribe function for chatMessageDeleted. The initial sender will also receive this event.

    Parameters

    • event: "chatMessageDeleted"

      The ChatMessageDeletedEvent.

    • listener: ((e: ChatMessageDeletedEvent) => void)

      The listener to handle the event.

        • (e: ChatMessageDeletedEvent): void
        • Parameters

          • e: ChatMessageDeletedEvent

          Returns void

    Returns void

  • Subscribe function for typingIndicatorReceived. The initial sender will also receive this event.

    Parameters

    • event: "typingIndicatorReceived"

      The TypingIndicatorReceivedEvent.

    • listener: ((e: TypingIndicatorReceivedEvent) => void)

      The listener to handle the event.

        • (e: TypingIndicatorReceivedEvent): void
        • Parameters

          • e: TypingIndicatorReceivedEvent

          Returns void

    Returns void

  • Subscribe function for readReceiptReceived.

    Parameters

    • event: "readReceiptReceived"

      The ReadReceiptReceivedEvent.

    • listener: ((e: ReadReceiptReceivedEvent) => void)

      The listener to handle the event.

        • (e: ReadReceiptReceivedEvent): void
        • Parameters

          • e: ReadReceiptReceivedEvent

          Returns void

    Returns void

  • Subscribe function for chatThreadCreated.

    Parameters

    • event: "chatThreadCreated"

      The ChatThreadCreatedEvent.

    • listener: ((e: ChatThreadCreatedEvent) => void)

      The listener to handle the event.

        • (e: ChatThreadCreatedEvent): void
        • Parameters

          • e: ChatThreadCreatedEvent

          Returns void

    Returns void

  • Subscribe function for chatThreadDeleted.

    Parameters

    • event: "chatThreadDeleted"

      The ChatThreadDeletedEvent.

    • listener: ((e: ChatThreadDeletedEvent) => void)

      The listener to handle the event.

        • (e: ChatThreadDeletedEvent): void
        • Parameters

          • e: ChatThreadDeletedEvent

          Returns void

    Returns void

  • Subscribe function for chatThreadPropertiesUpdated.

    Parameters

    • event: "chatThreadPropertiesUpdated"

      The ChatThreadPropertiesUpdatedEvent.

    • listener: ((e: ChatThreadPropertiesUpdatedEvent) => void)

      The listener to handle the event.

        • (e: ChatThreadPropertiesUpdatedEvent): void
        • Parameters

          • e: ChatThreadPropertiesUpdatedEvent

          Returns void

    Returns void

  • Subscribe function for participantsAdded.

    Parameters

    • event: "participantsAdded"

      The ParticipantsAddedEvent.

    • listener: ((e: ParticipantsAddedEvent) => void)

      The listener to handle the event.

        • (e: ParticipantsAddedEvent): void
        • Parameters

          • e: ParticipantsAddedEvent

          Returns void

    Returns void

  • Subscribe function for participantsRemoved.

    Parameters

    • event: "participantsRemoved"

      The ParticipantsRemovedEvent.

    • listener: ((e: ParticipantsRemovedEvent) => void)

      The listener to handle the event.

        • (e: ParticipantsRemovedEvent): void
        • Parameters

          • e: ParticipantsRemovedEvent

          Returns void

    Returns void

  • Subscribe function for realTimeNotificationConnected.

    Parameters

    • event: "realTimeNotificationConnected"

      The realTimeNotificationConnected Event

    • listener: (() => void)

      The listener to handle the event.

        • (): void
        • Returns void

    Returns void

  • Subscribe function for realTimeNotificationDisconnected.

    Parameters

    • event: "realTimeNotificationDisconnected"

      The realTimeNotificationDisconnected Event

    • listener: (() => void)

      The listener to handle the event.

        • (): void
        • Returns void

    Returns void

  • Start receiving realtime notifications. Call this function before subscribing to any event.

    Returns Promise<void>

  • Stop receiving realtime notifications. This function would unsubscribe to all events.

    Returns Promise<void>

Generated using TypeDoc