diff --git a/src/controllers/RTCRelayController.ts b/src/controllers/RTCRelayController.ts index 278b9bc..c36ede3 100644 --- a/src/controllers/RTCRelayController.ts +++ b/src/controllers/RTCRelayController.ts @@ -8,6 +8,13 @@ import { conf } from '../helpers/ConfigHelper'; * @author Pierre HUBERT */ +export interface RTCSocketMessage { + title: string, + callId ?: string, + peerId ?: string, + data: any +} + export class RTCRelayController { /** @@ -58,8 +65,11 @@ export class RTCRelayController { ws.addEventListener("close", () => this.WSClosed()); // Send ice configuration to server - this.SendMessage("config", { - iceServers: cnf.iceServers + this.SendMessage({ + title: "config", + data: { + iceServers: cnf.iceServers + }, }) } @@ -83,10 +93,12 @@ export class RTCRelayController { * @param title The title of the message to send * @param content The content of the message */ - private static async SendMessage(title: string, content: any) { + private static async SendMessage(msg: RTCSocketMessage) { this.currWs.send(JSON.stringify({ - title: title, - data: content + title: msg.title, + callId: msg.callId, + peerId: msg.peerId, + data: msg.data })); } } \ No newline at end of file