ChatClient class
Client per eseguire operazioni di chat
Costruttori
| Chat |
Crea un'istanza di ChatClient per una risorsa e un utente specificati. |
Metodi
| create |
Crea un thread di chat. Restituisce il client thread con l'ID del thread creato. |
| delete |
Elimina un thread di chat. |
| get |
Restituisce ChatThreadClient con l'ID thread specifico. |
| list |
Ottiene l'elenco dei thread di chat di un utente. |
| off("chat |
Annullare la sottoscrizione a chatMessageDeleted. |
| off("chat |
Annullare la sottoscrizione a chatMessageEdited. |
| off("chat |
Annullare la sottoscrizione a chatMessageReceived. |
| off("chat |
Annullare la sottoscrizione alla chatThreadCreated. |
| off("chat |
Annullare la sottoscrizione alla chatThreadDeleted. |
| off("chat |
Annullare la sottoscrizione a chatThreadPropertiesUpdated. |
| off("participants |
Annullare la sottoscrizione ai partecipantiAggiungi. |
| off("participants |
Annullare la sottoscrizione ai partecipantiRimo. |
| off("read |
Annullare la sottoscrizione a readReceiptReceived. |
| off("typing |
Annullare la sottoscrizione alla digitazioneIndicatorReceived. |
| on("chat |
Funzione Subscribe per chatMessageDeleted. Il mittente iniziale riceverà anche questo evento. |
| on("chat |
Funzione Subscribe per chatMessageEdited. Il mittente iniziale riceverà anche questo evento. |
| on("chat |
Funzione Subscribe per chatMessageReceived. Il mittente iniziale riceverà anche questo evento. È necessario chiamare startRealtimeNotifications prima di sottoscrivere qualsiasi evento. |
| on("chat |
Funzione Subscribe per chatThreadCreated. |
| on("chat |
Funzione Subscribe per chatThreadDeleted. |
| on("chat |
Funzione Subscribe per chatThreadPropertiesUpdated. |
| on("participants |
Funzione Subscribe per i partecipantiAdded. |
| on("participants |
Funzione Subscribe per i partecipantiRemoved. |
| on("read |
Funzione Subscribe per readReceiptReceived. |
| on("real |
Funzione Subscribe per realTimeNotificationConnected. |
| on("real |
Funzione Subscribe per realTimeNotificationDisconnected. |
| on("typing |
Funzione Subscribe per la digitazioneIndicatorReceived. Il mittente iniziale riceverà anche questo evento. |
| start |
Iniziare a ricevere notifiche in tempo reale. Chiamare questa funzione prima di sottoscrivere qualsiasi evento. |
| stop |
Interrompere la ricezione di notifiche in tempo reale. Questa funzione annulla la sottoscrizione a tutti gli eventi. |
Dettagli costruttore
ChatClient(string, CommunicationTokenCredential, ChatClientOptions)
Crea un'istanza di ChatClient per una risorsa e un utente specificati.
new ChatClient(endpoint: string, credential: CommunicationTokenCredential, options?: ChatClientOptions)
Parametri
- endpoint
-
string
URL della risorsa servizi di comunicazione.
- credential
- CommunicationTokenCredential
Credenziali del token. Usare AzureCommunicationTokenCredential da @azure/communication-common per creare credenziali.
- options
- ChatClientOptions
Opzioni client aggiuntive.
Dettagli metodo
createChatThread(CreateChatThreadRequest, CreateChatThreadOptions)
Crea un thread di chat. Restituisce il client thread con l'ID del thread creato.
function createChatThread(request: CreateChatThreadRequest, options?: CreateChatThreadOptions): Promise<CreateChatThreadResult>
Parametri
- request
- CreateChatThreadRequest
Richiesta di creazione di un thread di chat.
- options
- CreateChatThreadOptions
Opzioni dell'operazione.
Restituisce
Promise<CreateChatThreadResult>
deleteChatThread(string, OperationOptions)
Elimina un thread di chat.
function deleteChatThread(threadId: string, options?: OperationOptions): Promise<void>
Parametri
- threadId
-
string
ID del thread da eliminare.
- options
- OperationOptions
Opzioni dell'operazione.
Restituisce
Promise<void>
getChatThreadClient(string)
Restituisce ChatThreadClient con l'ID thread specifico.
function getChatThreadClient(threadId: string): ChatThreadClient
Parametri
- threadId
-
string
ID thread per ChatThreadClient
Restituisce
listChatThreads(ChatListChatThreadsOptionalParams)
Ottiene l'elenco dei thread di chat di un utente.
function listChatThreads(options?: ChatListChatThreadsOptionalParams): PagedAsyncIterableIterator<ChatThreadItem, ChatThreadItem[], PageSettings>
Parametri
- options
- RestListChatThreadsOptions
Elencare le opzioni dei thread di chat.
Restituisce
off("chatMessageDeleted", (e: ChatMessageDeletedEvent) => void)
Annullare la sottoscrizione a chatMessageDeleted.
function off(event: "chatMessageDeleted", listener: (e: ChatMessageDeletedEvent) => void)
Parametri
- event
-
"chatMessageDeleted"
L'evento ChatMessageDeleted.
- listener
-
(e: ChatMessageDeletedEvent) => void
Listener per gestire l'evento.
off("chatMessageEdited", (e: ChatMessageEditedEvent) => void)
Annullare la sottoscrizione a chatMessageEdited.
function off(event: "chatMessageEdited", listener: (e: ChatMessageEditedEvent) => void)
Parametri
- event
-
"chatMessageEdited"
L'oggetto ChatMessageEditedEvent.
- listener
-
(e: ChatMessageEditedEvent) => void
Listener per gestire l'evento.
off("chatMessageReceived", (e: ChatMessageReceivedEvent) => void)
Annullare la sottoscrizione a chatMessageReceived.
function off(event: "chatMessageReceived", listener: (e: ChatMessageReceivedEvent) => void)
Parametri
- event
-
"chatMessageReceived"
L'evento ChatMessageReceived.
- listener
-
(e: ChatMessageReceivedEvent) => void
Listener per gestire l'evento.
off("chatThreadCreated", (e: ChatThreadCreatedEvent) => void)
Annullare la sottoscrizione alla chatThreadCreated.
function off(event: "chatThreadCreated", listener: (e: ChatThreadCreatedEvent) => void)
Parametri
- event
-
"chatThreadCreated"
L'evento ChatThreadCreatedEvent.
- listener
-
(e: ChatThreadCreatedEvent) => void
Listener per gestire l'evento.
off("chatThreadDeleted", (e: ChatThreadDeletedEvent) => void)
Annullare la sottoscrizione alla chatThreadDeleted.
function off(event: "chatThreadDeleted", listener: (e: ChatThreadDeletedEvent) => void)
Parametri
- event
-
"chatThreadDeleted"
L'evento ChatThreadDeleted.
- listener
-
(e: ChatThreadDeletedEvent) => void
Listener per gestire l'evento.
off("chatThreadPropertiesUpdated", (e: ChatThreadPropertiesUpdatedEvent) => void)
Annullare la sottoscrizione a chatThreadPropertiesUpdated.
function off(event: "chatThreadPropertiesUpdated", listener: (e: ChatThreadPropertiesUpdatedEvent) => void)
Parametri
- event
-
"chatThreadPropertiesUpdated"
L'evento ChatThreadPropertiesUpdatedEvent.
- listener
-
(e: ChatThreadPropertiesUpdatedEvent) => void
Listener per gestire l'evento.
off("participantsAdded", (e: ParticipantsAddedEvent) => void)
Annullare la sottoscrizione ai partecipantiAggiungi.
function off(event: "participantsAdded", listener: (e: ParticipantsAddedEvent) => void)
Parametri
- event
-
"participantsAdded"
PartecipantiAddedEvent.
- listener
-
(e: ParticipantsAddedEvent) => void
Listener per gestire l'evento.
off("participantsRemoved", (e: ParticipantsRemovedEvent) => void)
Annullare la sottoscrizione ai partecipantiRimo.
function off(event: "participantsRemoved", listener: (e: ParticipantsRemovedEvent) => void)
Parametri
- event
-
"participantsRemoved"
PartecipantiRemovedEvent.
- listener
-
(e: ParticipantsRemovedEvent) => void
Listener per gestire l'evento.
off("readReceiptReceived", (e: ReadReceiptReceivedEvent) => void)
Annullare la sottoscrizione a readReceiptReceived.
function off(event: "readReceiptReceived", listener: (e: ReadReceiptReceivedEvent) => void)
Parametri
- event
-
"readReceiptReceived"
L'oggetto ReadReceiptReceivedEvent.
- listener
-
(e: ReadReceiptReceivedEvent) => void
Listener per gestire l'evento.
off("typingIndicatorReceived", (e: TypingIndicatorReceivedEvent) => void)
Annullare la sottoscrizione alla digitazioneIndicatorReceived.
function off(event: "typingIndicatorReceived", listener: (e: TypingIndicatorReceivedEvent) => void)
Parametri
- event
-
"typingIndicatorReceived"
L'evento TypingIndicatorReceivedEvent.
- listener
-
(e: TypingIndicatorReceivedEvent) => void
Listener per gestire l'evento.
on("chatMessageDeleted", (e: ChatMessageDeletedEvent) => void)
Funzione Subscribe per chatMessageDeleted. Il mittente iniziale riceverà anche questo evento.
function on(event: "chatMessageDeleted", listener: (e: ChatMessageDeletedEvent) => void)
Parametri
- event
-
"chatMessageDeleted"
L'evento ChatMessageDeleted.
- listener
-
(e: ChatMessageDeletedEvent) => void
Listener per gestire l'evento.
on("chatMessageEdited", (e: ChatMessageEditedEvent) => void)
Funzione Subscribe per chatMessageEdited. Il mittente iniziale riceverà anche questo evento.
function on(event: "chatMessageEdited", listener: (e: ChatMessageEditedEvent) => void)
Parametri
- event
-
"chatMessageEdited"
L'oggetto ChatMessageEditedEvent.
- listener
-
(e: ChatMessageEditedEvent) => void
Listener per gestire l'evento.
on("chatMessageReceived", (e: ChatMessageReceivedEvent) => void)
Funzione Subscribe per chatMessageReceived. Il mittente iniziale riceverà anche questo evento. È necessario chiamare startRealtimeNotifications prima di sottoscrivere qualsiasi evento.
function on(event: "chatMessageReceived", listener: (e: ChatMessageReceivedEvent) => void)
Parametri
- event
-
"chatMessageReceived"
L'evento ChatMessageReceived.
- listener
-
(e: ChatMessageReceivedEvent) => void
Listener per gestire l'evento.
on("chatThreadCreated", (e: ChatThreadCreatedEvent) => void)
Funzione Subscribe per chatThreadCreated.
function on(event: "chatThreadCreated", listener: (e: ChatThreadCreatedEvent) => void)
Parametri
- event
-
"chatThreadCreated"
L'evento ChatThreadCreatedEvent.
- listener
-
(e: ChatThreadCreatedEvent) => void
Listener per gestire l'evento.
on("chatThreadDeleted", (e: ChatThreadDeletedEvent) => void)
Funzione Subscribe per chatThreadDeleted.
function on(event: "chatThreadDeleted", listener: (e: ChatThreadDeletedEvent) => void)
Parametri
- event
-
"chatThreadDeleted"
L'evento ChatThreadDeleted.
- listener
-
(e: ChatThreadDeletedEvent) => void
Listener per gestire l'evento.
on("chatThreadPropertiesUpdated", (e: ChatThreadPropertiesUpdatedEvent) => void)
Funzione Subscribe per chatThreadPropertiesUpdated.
function on(event: "chatThreadPropertiesUpdated", listener: (e: ChatThreadPropertiesUpdatedEvent) => void)
Parametri
- event
-
"chatThreadPropertiesUpdated"
L'evento ChatThreadPropertiesUpdatedEvent.
- listener
-
(e: ChatThreadPropertiesUpdatedEvent) => void
Listener per gestire l'evento.
on("participantsAdded", (e: ParticipantsAddedEvent) => void)
Funzione Subscribe per i partecipantiAdded.
function on(event: "participantsAdded", listener: (e: ParticipantsAddedEvent) => void)
Parametri
- event
-
"participantsAdded"
PartecipantiAddedEvent.
- listener
-
(e: ParticipantsAddedEvent) => void
Listener per gestire l'evento.
on("participantsRemoved", (e: ParticipantsRemovedEvent) => void)
Funzione Subscribe per i partecipantiRemoved.
function on(event: "participantsRemoved", listener: (e: ParticipantsRemovedEvent) => void)
Parametri
- event
-
"participantsRemoved"
PartecipantiRemovedEvent.
- listener
-
(e: ParticipantsRemovedEvent) => void
Listener per gestire l'evento.
on("readReceiptReceived", (e: ReadReceiptReceivedEvent) => void)
Funzione Subscribe per readReceiptReceived.
function on(event: "readReceiptReceived", listener: (e: ReadReceiptReceivedEvent) => void)
Parametri
- event
-
"readReceiptReceived"
L'oggetto ReadReceiptReceivedEvent.
- listener
-
(e: ReadReceiptReceivedEvent) => void
Listener per gestire l'evento.
on("realTimeNotificationConnected", () => void)
Funzione Subscribe per realTimeNotificationConnected.
function on(event: "realTimeNotificationConnected", listener: () => void)
Parametri
- event
-
"realTimeNotificationConnected"
Evento realTimeNotificationConnected
- listener
-
() => void
Listener per gestire l'evento.
on("realTimeNotificationDisconnected", () => void)
Funzione Subscribe per realTimeNotificationDisconnected.
function on(event: "realTimeNotificationDisconnected", listener: () => void)
Parametri
- event
-
"realTimeNotificationDisconnected"
Evento realTimeNotificationDisconnected
- listener
-
() => void
Listener per gestire l'evento.
on("typingIndicatorReceived", (e: TypingIndicatorReceivedEvent) => void)
Funzione Subscribe per la digitazioneIndicatorReceived. Il mittente iniziale riceverà anche questo evento.
function on(event: "typingIndicatorReceived", listener: (e: TypingIndicatorReceivedEvent) => void)
Parametri
- event
-
"typingIndicatorReceived"
L'evento TypingIndicatorReceivedEvent.
- listener
-
(e: TypingIndicatorReceivedEvent) => void
Listener per gestire l'evento.
startRealtimeNotifications()
Iniziare a ricevere notifiche in tempo reale. Chiamare questa funzione prima di sottoscrivere qualsiasi evento.
function startRealtimeNotifications(): Promise<void>
Restituisce
Promise<void>
stopRealtimeNotifications()
Interrompere la ricezione di notifiche in tempo reale. Questa funzione annulla la sottoscrizione a tutti gli eventi.
function stopRealtimeNotifications(): Promise<void>
Restituisce
Promise<void>