feat(webapi): include cid in ServerEvent::Msg

This commit is contained in:
oxalica 2024-10-08 21:14:13 -04:00
parent 814fac1974
commit ff7fd9e4b2
6 changed files with 18 additions and 18 deletions

View file

@ -331,14 +331,15 @@ async function connectServer(newServerUrl) {
};
ws.onmessage = async (e) => {
console.log('ws event', e.data);
const msg = JSON.parse(e.data);
if (msg.msg !== undefined) {
if (msg.msg.signee.payload.room === curRoom) {
await showChatMsg(msg.msg);
const evt = JSON.parse(e.data);
if (evt.msg !== undefined) {
if (evt.msg.signee.payload.room === curRoom) {
lastCid = evt.msg.cid;
await showChatMsg(evt.msg);
} else {
console.log('ignore background room msg');
}
} else if (msg.lagged !== undefined) {
} else if (evt.lagged !== undefined) {
log('some events are dropped because of queue overflow')
} else {
log(`unknown ws msg: ${e.data}`);