消息模块开发完成

This commit is contained in:
2026-05-18 23:03:28 +08:00
parent 2c6a7af31b
commit 85c0b0226d
6 changed files with 202 additions and 5 deletions

View File

@@ -221,6 +221,18 @@ export class WebSocketSignaling extends EventTarget {
case "broadcast":
this.dispatchEvent(new CustomEvent('on-message', { detail: msg.message }));
break;
case "invite-call":
this.dispatchEvent(new CustomEvent('invite-call', { detail: msg.data }));
break;
case "invite-accepted":
this.dispatchEvent(new CustomEvent('invite-accepted', { detail: msg.data }));
break;
case "invite-rejected":
this.dispatchEvent(new CustomEvent('invite-rejected', { detail: msg.data }));
break;
case "invite-failed":
this.dispatchEvent(new CustomEvent('invite-failed', { detail: msg.data }));
break;
default:
break;
}
@@ -288,4 +300,22 @@ export class WebSocketSignaling extends EventTarget {
Logger.log(sendJson);
this.websocket.send(sendJson);
}
sendInviteCall(payload) {
const sendJson = JSON.stringify({ type: 'invite-call', data: payload });
Logger.log(sendJson);
this.websocket.send(sendJson);
}
sendInviteAccepted(payload) {
const sendJson = JSON.stringify({ type: 'invite-accepted', data: payload });
Logger.log(sendJson);
this.websocket.send(sendJson);
}
sendInviteRejected(payload) {
const sendJson = JSON.stringify({ type: 'invite-rejected', data: payload });
Logger.log(sendJson);
this.websocket.send(sendJson);
}
}