学习TypeScript 和 WebSockets,处理 WebSocket 消息。 WebSocket 是一种实时通信协议,用于在客户端和服务器之间建立双向通信。
学习如何在客户端使用 WebSocket 进行连接、发送和接收消息。
// 修改阅读状态
store.socket.on("changMsgstatus", (data: any) => {
store.conversitionList.map((x: Conversition) => {
if (x.timestamp != null && x.timestamp == data.timestamp) {
x.status = 1
}
})
})
// 加入会话成功
store.socket.on("joinSuccess", (data: any) => {
store.userInfo && (store.userInfo.onlineStatus = true)
store.conversitionList = data.conversition
store.sessionList = data.historySessionList
})

浙公网安备 33010602011771号