保利威文档中心

幫助中心

聊天室模組

更新時間:2026-01-19 09:16:42
  • 聊天室模块(chat) 是一個服務於保利威聊天室服務的模組,包括獲取和發送聊天室訊息、聊天室使用者登入登出、獲取線上列表等功能。
  • 該模組基於保利威的 聊天室SDK 實現,並透過 WebSocket 的方式來實現客戶端與伺服端的通訊。

一、Api 方法概覽

Api 方法 說明
getSocket 獲取聊天室 socket 實例
setChatHistoryEncrypt 設定聊天歷史訊息是否加密
getChatInfo 獲取聊天室資訊
getChatSetting 獲取聊天室設定
getChatHistory 獲取聊天歷史訊息
getChatHistoryBySessionId 根據場次號分頁獲取聊天歷史訊息
getChatHistoryByTime 根據時間戳獲取聊天歷史訊息
getRealtimeLikes 獲取即時的點讚數
sendLike 發送點讚數
sendEmotionalFeedback 發送情緒反饋
sendSpeakMsg 發送文字訊息
sendImageMsg 發送圖片訊息
sendEmotionImageMsg 發送表情圖片訊息
sendSystemMsg 發送系統訊息
sendCustomMessage 發送自訂訊息(客戶端)
insertLocalRewardChatMsg 插入本地打賞訊息
getFullMessage 獲取超長訊息的完整文字
startOnlineUserListPolling 開始線上使用者列表輪詢
stopOnlineUserListPolling 結束線上使用者列表輪詢
getOnlineUserListNew 獲取線上使用者列表新介面
getOnlineUserCount 獲取聊天室的即時線上人數
parseSpeakContent 轉換發言內容
getChatMsgReplayHistoryList 獲取聊天訊息重播歷史資料
processChatMsgReplay 處理聊天訊息重播
initChatMsgReplay 初始化聊天訊息重播
addChatMsgReplayCachePlugin 新增聊天重播本地快取外掛
removeChatMsg 根據 id 移除聊天訊息
replaceChatMsg 根據 id,替換對應的聊天內容
getSpeakTopInfo 獲取評論上牆資料
setSpeakTop 設定評論上牆資料
cancelSpeakTop 取消評論上牆
getChatCustomIntroductionText 獲取聊天區通知文字
getChannelFileList 獲取頻道檔案列表

二、Event 事件概覽

Event 事件 說明
ChatEvents.ChatSdkV2Setuped V2 的聊天室 SDK 安裝完成回呼
ChatEvents.ChatInfoChange 聊天室資訊修改
ChatEvents.ChatReconnectSuccess 聊天室重新連線成功事件
ChatEvents.ChatConnectFail 聊天室連線失敗事件
ChatEvents.ChatMessage 聊天訊息事件
ChatEvents.ReplaceChatMessage 替換聊天訊息事件
ChatEvents.ChatLike 點讚事件
ChatEvents.ChatLikeCountChange 點讚數修改事件
ChatEvents.ChatEmotionalFeedback 情緒反饋事件
ChatEvents.ChatUserLogin 聊天室使用者登入事件
ChatEvents.ChatUserLogout 聊天室使用者登出事件
ChatEvents.CurrentUserRelogin 目前使用者重複登入事件
ChatEvents.ClearMsgHistory 清空聊天室事件
ChatEvents.RemoveChatMsg 刪除某則訊息事件
ChatEvents.CloseChatRoom 聊天室關閉事件
ChatEvents.OpenChatRoom 聊天室開啟事件
ChatEvents.OnlineUserCountChange 線上人數改變事件
ChatEvents.OnlineUserListChange 線上使用者列表改變事件
ChatEvents.ChatMsgReplayReload 聊天訊息重播-重新載入
ChatEvents.ChatMsgReplayStatusChange 聊天訊息重播狀態
ChatEvents.OverMaxOnlineCount 超出直播間最大線上人數
ChatEvents.WhiteListRemoveUser 白名單移除使用者
ChatEvents.SpeakToTop 評論上牆事件
ChatEvents.SpeakCancelTop 評論取消上牆事件
ChatEvents.OverLoginLimit 超出頻道登入限制事件
联系客服,在线咨询