StatefulChatClient interface
定義方法,允許 {@Link @azure/communication-chat#ChatClient} 與集中式產生的狀態搭配使用。
介面提供 Proxy 狀態的存取權,也允許註冊狀態變更事件的處理常式。
- Extends
方法
get |
保留我們可以從 ChatClient {@Link 為 ChatClientState {@Link @azure/communication-chat#ChatClient} ChatClientState} 進行 Proxy 的所有狀態。 |
off |
允許取消註冊 'stateChanged' 事件。 |
on |
允許為 'stateChanged' 事件註冊處理常式。 |
繼承的方法
方法詳細資料
getState()
保留我們可以從 ChatClient {@Link 為 ChatClientState {@Link @azure/communication-chat#ChatClient} ChatClientState} 進行 Proxy 的所有狀態。
function getState(): ChatClientState
傳回
offStateChange((state: ChatClientState) => void)
允許取消註冊 'stateChanged' 事件。
function offStateChange(handler: (state: ChatClientState) => void)
參數
- handler
-
(state: ChatClientState) => void
要取消訂閱的原始回呼。
onStateChange((state: ChatClientState) => void)
允許為 'stateChanged' 事件註冊處理常式。
function onStateChange(handler: (state: ChatClientState) => void)
參數
- handler
-
(state: ChatClientState) => void
回呼以接收狀態。
繼承的方法的詳細資料
createChatThread(CreateChatThreadRequest, CreateChatThreadOptions)
建立聊天對話。 傳回具有所建立執行緒識別碼的執行緒用戶端。
function createChatThread(request: CreateChatThreadRequest, options?: CreateChatThreadOptions): Promise<CreateChatThreadResult>
參數
- request
- CreateChatThreadRequest
建立聊天對話的要求。
- options
- CreateChatThreadOptions
作業選項。
傳回
Promise<CreateChatThreadResult>
繼承自 ChatClient.createChatThread
deleteChatThread(string, OperationOptions)
刪除聊天對話。
function deleteChatThread(threadId: string, options?: OperationOptions): Promise<void>
參數
- threadId
-
string
要刪除的執行緒識別碼。
- options
- OperationOptions
作業選項。
傳回
Promise<void>
繼承自 ChatClient.deleteChatThread
getChatThreadClient(string)
傳回具有特定執行緒識別碼的 ChatThreadClient。
function getChatThreadClient(threadId: string): ChatThreadClient
參數
- threadId
-
string
ChatThreadClient 的執行緒識別碼
傳回
繼承自 ChatClient.getChatThreadClient
listChatThreads(RestListChatThreadsOptions)
取得使用者的聊天對話清單。
function listChatThreads(options?: RestListChatThreadsOptions): PagedAsyncIterableIterator<ChatThreadItem, ChatThreadItem[], PageSettings>
參數
- options
- RestListChatThreadsOptions
列出聊天線程選項。
傳回
繼承自 ChatClient.listChatThreads
off("chatMessageDeleted", (e: ChatMessageDeletedEvent) => void)
取消訂閱 chatMessageDeleted。
function off(event: "chatMessageDeleted", listener: (e: ChatMessageDeletedEvent) => void)
參數
- event
-
"chatMessageDeleted"
ChatMessageDeletedEvent。
- listener
-
(e: ChatMessageDeletedEvent) => void
要處理事件的接聽程式。
繼承自 ChatClient.off
off("chatMessageEdited", (e: ChatMessageEditedEvent) => void)
取消訂閱 chatMessageEdited。
function off(event: "chatMessageEdited", listener: (e: ChatMessageEditedEvent) => void)
參數
- event
-
"chatMessageEdited"
ChatMessageEditedEvent。
- listener
-
(e: ChatMessageEditedEvent) => void
要處理事件的接聽程式。
繼承自 ChatClient.off
off("chatMessageReceived", (e: ChatMessageReceivedEvent) => void)
取消訂閱 chatMessageReceived。
function off(event: "chatMessageReceived", listener: (e: ChatMessageReceivedEvent) => void)
參數
- event
-
"chatMessageReceived"
ChatMessageReceivedEvent。
- listener
-
(e: ChatMessageReceivedEvent) => void
要處理事件的接聽程式。
繼承自 ChatClient.off
off("chatThreadCreated", (e: ChatThreadCreatedEvent) => void)
取消訂閱 chatThreadCreated。
function off(event: "chatThreadCreated", listener: (e: ChatThreadCreatedEvent) => void)
參數
- event
-
"chatThreadCreated"
ChatThreadCreatedEvent。
- listener
-
(e: ChatThreadCreatedEvent) => void
要處理事件的接聽程式。
繼承自 ChatClient.off
off("chatThreadDeleted", (e: ChatThreadDeletedEvent) => void)
取消訂閱 chatThreadDeleted。
function off(event: "chatThreadDeleted", listener: (e: ChatThreadDeletedEvent) => void)
參數
- event
-
"chatThreadDeleted"
ChatThreadDeletedEvent。
- listener
-
(e: ChatThreadDeletedEvent) => void
要處理事件的接聽程式。
繼承自 ChatClient.off
off("chatThreadPropertiesUpdated", (e: ChatThreadPropertiesUpdatedEvent) => void)
取消訂閱 chatThreadPropertiesUpdated。
function off(event: "chatThreadPropertiesUpdated", listener: (e: ChatThreadPropertiesUpdatedEvent) => void)
參數
- event
-
"chatThreadPropertiesUpdated"
ChatThreadPropertiesUpdatedEvent。
- listener
-
(e: ChatThreadPropertiesUpdatedEvent) => void
要處理事件的接聽程式。
繼承自 ChatClient.off
off("participantsAdded", (e: ParticipantsAddedEvent) => void)
取消訂閱參與者新增。
function off(event: "participantsAdded", listener: (e: ParticipantsAddedEvent) => void)
參數
- event
-
"participantsAdded"
ParticipantsAddedEvent。
- listener
-
(e: ParticipantsAddedEvent) => void
要處理事件的接聽程式。
繼承自 ChatClient.off
off("participantsRemoved", (e: ParticipantsRemovedEvent) => void)
取消訂閱參與者Removed。
function off(event: "participantsRemoved", listener: (e: ParticipantsRemovedEvent) => void)
參數
- event
-
"participantsRemoved"
ParticipantsRemovedEvent。
- listener
-
(e: ParticipantsRemovedEvent) => void
要處理事件的接聽程式。
繼承自 ChatClient.off
off("readReceiptReceived", (e: ReadReceiptReceivedEvent) => void)
取消訂閱 readReceiptReceived。
function off(event: "readReceiptReceived", listener: (e: ReadReceiptReceivedEvent) => void)
參數
- event
-
"readReceiptReceived"
ReadReceiptReceivedEvent。
- listener
-
(e: ReadReceiptReceivedEvent) => void
要處理事件的接聽程式。
繼承自 ChatClient.off
off("typingIndicatorReceived", (e: TypingIndicatorReceivedEvent) => void)
取消訂閱輸入IndicatorReceived。
function off(event: "typingIndicatorReceived", listener: (e: TypingIndicatorReceivedEvent) => void)
參數
- event
-
"typingIndicatorReceived"
TypingIndicatorReceivedEvent。
- listener
-
(e: TypingIndicatorReceivedEvent) => void
要處理事件的接聽程式。
繼承自 ChatClient.off
on("chatMessageDeleted", (e: ChatMessageDeletedEvent) => void)
chatMessageDeleted 的訂閱函式。 初始傳送者也會收到此事件。
function on(event: "chatMessageDeleted", listener: (e: ChatMessageDeletedEvent) => void)
參數
- event
-
"chatMessageDeleted"
ChatMessageDeletedEvent。
- listener
-
(e: ChatMessageDeletedEvent) => void
要處理事件的接聽程式。
繼承自 ChatClient.on
on("chatMessageEdited", (e: ChatMessageEditedEvent) => void)
chatMessageEdited 的訂閱函式。 初始傳送者也會收到此事件。
function on(event: "chatMessageEdited", listener: (e: ChatMessageEditedEvent) => void)
參數
- event
-
"chatMessageEdited"
ChatMessageEditedEvent。
- listener
-
(e: ChatMessageEditedEvent) => void
要處理事件的接聽程式。
繼承自 ChatClient.on
on("chatMessageReceived", (e: ChatMessageReceivedEvent) => void)
chatMessageReceived 的訂閱函式。 初始傳送者也會收到此事件。 您必須在訂閱任何事件之前呼叫 startRealtimeNotifications。
function on(event: "chatMessageReceived", listener: (e: ChatMessageReceivedEvent) => void)
參數
- event
-
"chatMessageReceived"
ChatMessageReceivedEvent。
- listener
-
(e: ChatMessageReceivedEvent) => void
要處理事件的接聽程式。
繼承自 ChatClient.on
on("chatThreadCreated", (e: ChatThreadCreatedEvent) => void)
chatThreadCreated 的訂閱函式。
function on(event: "chatThreadCreated", listener: (e: ChatThreadCreatedEvent) => void)
參數
- event
-
"chatThreadCreated"
ChatThreadCreatedEvent。
- listener
-
(e: ChatThreadCreatedEvent) => void
要處理事件的接聽程式。
繼承自 ChatClient.on
on("chatThreadDeleted", (e: ChatThreadDeletedEvent) => void)
chatThreadDeleted 的訂閱函式。
function on(event: "chatThreadDeleted", listener: (e: ChatThreadDeletedEvent) => void)
參數
- event
-
"chatThreadDeleted"
ChatThreadDeletedEvent。
- listener
-
(e: ChatThreadDeletedEvent) => void
要處理事件的接聽程式。
繼承自 ChatClient.on
on("chatThreadPropertiesUpdated", (e: ChatThreadPropertiesUpdatedEvent) => void)
chatThreadPropertiesUpdated 的 Subscribe 函式。
function on(event: "chatThreadPropertiesUpdated", listener: (e: ChatThreadPropertiesUpdatedEvent) => void)
參數
- event
-
"chatThreadPropertiesUpdated"
ChatThreadPropertiesUpdatedEvent。
- listener
-
(e: ChatThreadPropertiesUpdatedEvent) => void
要處理事件的接聽程式。
繼承自 ChatClient.on
on("participantsAdded", (e: ParticipantsAddedEvent) => void)
訂閱參與者的函式Added。
function on(event: "participantsAdded", listener: (e: ParticipantsAddedEvent) => void)
參數
- event
-
"participantsAdded"
ParticipantsAddedEvent。
- listener
-
(e: ParticipantsAddedEvent) => void
要處理事件的接聽程式。
繼承自 ChatClient.on
on("participantsRemoved", (e: ParticipantsRemovedEvent) => void)
針對參與者訂閱函式Removed。
function on(event: "participantsRemoved", listener: (e: ParticipantsRemovedEvent) => void)
參數
- event
-
"participantsRemoved"
ParticipantsRemovedEvent。
- listener
-
(e: ParticipantsRemovedEvent) => void
要處理事件的接聽程式。
繼承自 ChatClient.on
on("readReceiptReceived", (e: ReadReceiptReceivedEvent) => void)
readReceiptReceived 的 Subscribe 函式。
function on(event: "readReceiptReceived", listener: (e: ReadReceiptReceivedEvent) => void)
參數
- event
-
"readReceiptReceived"
ReadReceiptReceivedEvent。
- listener
-
(e: ReadReceiptReceivedEvent) => void
要處理事件的接聽程式。
繼承自 ChatClient.on
on("realTimeNotificationConnected", () => void)
realTimeNotificationConnected 的 Subscribe 函式。
function on(event: "realTimeNotificationConnected", listener: () => void)
參數
- event
-
"realTimeNotificationConnected"
realTimeNotificationConnected 事件
- listener
-
() => void
要處理事件的接聽程式。
繼承自 ChatClient.on
on("realTimeNotificationDisconnected", () => void)
realTimeNotificationDisconnected 的 Subscribe 函式。
function on(event: "realTimeNotificationDisconnected", listener: () => void)
參數
- event
-
"realTimeNotificationDisconnected"
realTimeNotificationDisconnected 事件
- listener
-
() => void
要處理事件的接聽程式。
繼承自 ChatClient.on
on("typingIndicatorReceived", (e: TypingIndicatorReceivedEvent) => void)
Subscribe 函式,用於 typingIndicatorReceived。 初始傳送者也會收到此事件。
function on(event: "typingIndicatorReceived", listener: (e: TypingIndicatorReceivedEvent) => void)
參數
- event
-
"typingIndicatorReceived"
TypingIndicatorReceivedEvent。
- listener
-
(e: TypingIndicatorReceivedEvent) => void
要處理事件的接聽程式。
繼承自 ChatClient.on
startRealtimeNotifications()
開始接收即時通知。 訂閱任何事件之前,請先呼叫此函式。
function startRealtimeNotifications(): Promise<void>
傳回
Promise<void>
繼承自 ChatClient.startRealtimeNotifications
stopRealtimeNotifications()
停止接收即時通知。 此函式會取消訂閱所有事件。
function stopRealtimeNotifications(): Promise<void>
傳回
Promise<void>
繼承自 ChatClient.stopRealtimeNotifications