聊天室显示自己的消息

This commit is contained in:
2023-10-19 00:01:58 +08:00
parent b14aaa6ec3
commit 273633bda4
1 changed files with 1 additions and 0 deletions

View File

@ -145,6 +145,7 @@ const chat = new Chat({
onsend: async (text, list) => { onsend: async (text, list) => {
console.log('发送消息', text) console.log('发送消息', text)
clientList.send('chat', JSON.stringify({ type: 'message', text })) clientList.send('chat', JSON.stringify({ type: 'message', text }))
chat.add({ name, text, time: new Date().toLocaleTimeString() })
console.log('发送结束') console.log('发送结束')
}, },
onexit: async () => { onexit: async () => {