Add webRTC handlers
- Bind webRCT callbacks from socket
- Handle incoming account message for webRTC
GitLab: #53
Change-Id: I4ed28e7ca41e8e3870968819c75ffad249a188d0
diff --git a/server/src/ws.ts b/server/src/ws.ts
index 0081e59..58cd3db 100644
--- a/server/src/ws.ts
+++ b/server/src/ws.ts
@@ -51,6 +51,10 @@
ws.on('message', (messageString: string) => {
const message: WebSocketMessage = JSON.parse(messageString);
+ if (!message.type || !message.data) {
+ ws.send('Incorrect format (require type and data)');
+ return;
+ }
const callbacks = this.callbacks.get(message.type);
if (callbacks) {
for (const callback of callbacks) {