summary refs log tree commit diff
path: root/src/webrtc/events
diff options
context:
space:
mode:
Diffstat (limited to 'src/webrtc/events')
-rw-r--r--src/webrtc/events/Connection.ts9
-rw-r--r--src/webrtc/events/Message.ts9
2 files changed, 4 insertions, 14 deletions
diff --git a/src/webrtc/events/Connection.ts b/src/webrtc/events/Connection.ts
index 6c5bab03..799e092e 100644
--- a/src/webrtc/events/Connection.ts
+++ b/src/webrtc/events/Connection.ts
@@ -28,11 +28,7 @@ import { onMessage } from "./Message";
 // TODO: specify rate limit in config
 // TODO: check msg max size
 
-export async function Connection(
-	this: WS.Server,
-	socket: WebSocket,
-	request: IncomingMessage,
-) {
+export async function Connection(this: WS.Server, socket: WebSocket, request: IncomingMessage) {
 	try {
 		socket.on("close", onClose.bind(socket));
 		socket.on("message", onMessage.bind(socket));
@@ -57,8 +53,7 @@ export async function Connection(
 
 		socket.encoding = "json";
 		socket.version = Number(searchParams.get("v")) || 5;
-		if (socket.version < 3)
-			return socket.close(CLOSECODES.Unknown_error, "invalid version");
+		if (socket.version < 3) return socket.close(CLOSECODES.Unknown_error, "invalid version");
 
 		setHeartbeat(socket);
 
diff --git a/src/webrtc/events/Message.ts b/src/webrtc/events/Message.ts
index 22189e95..5145d640 100644
--- a/src/webrtc/events/Message.ts
+++ b/src/webrtc/events/Message.ts
@@ -31,8 +31,7 @@ const PayloadSchema = {
 export async function onMessage(this: WebSocket, buffer: Buffer) {
 	try {
 		var data: Payload = JSON.parse(buffer.toString());
-		if (data.op !== VoiceOPCodes.IDENTIFY && !this.user_id)
-			return this.close(CLOSECODES.Not_authenticated);
+		if (data.op !== VoiceOPCodes.IDENTIFY && !this.user_id) return this.close(CLOSECODES.Not_authenticated);
 
 		// @ts-ignore
 		const OPCodeHandler = OPCodeHandlers[data.op];
@@ -44,11 +43,7 @@ export async function onMessage(this: WebSocket, buffer: Buffer) {
 			return;
 		}
 
-		if (
-			![VoiceOPCodes.HEARTBEAT, VoiceOPCodes.SPEAKING].includes(
-				data.op as VoiceOPCodes,
-			)
-		) {
+		if (![VoiceOPCodes.HEARTBEAT, VoiceOPCodes.SPEAKING].includes(data.op as VoiceOPCodes)) {
 			// @ts-ignore
 			console.log("[WebRTC] Opcode " + VoiceOPCodes[data.op]);
 		}