summary refs log tree commit diff
path: root/src/gateway
diff options
context:
space:
mode:
Diffstat (limited to 'src/gateway')
-rw-r--r--src/gateway/events/Message.ts1
-rw-r--r--src/gateway/opcodes/VoiceServerPing.ts9
-rw-r--r--src/gateway/opcodes/index.ts5
3 files changed, 14 insertions, 1 deletions
diff --git a/src/gateway/events/Message.ts b/src/gateway/events/Message.ts
index e5ee5828..d58db1c3 100644
--- a/src/gateway/events/Message.ts
+++ b/src/gateway/events/Message.ts
@@ -43,6 +43,7 @@ export async function Message(this: WebSocket, buffer: Buffer) {
 	const OPCodeHandler = OPCodeHandlers[data.op];
 	if (!OPCodeHandler) {
 		console.error("[Gateway] Unkown opcode " + data.op);
+		if(process.env.WS_VERBOSE_UNKNOWN) console.log(data);
 		// TODO: if all opcodes are implemented comment this out:
 		// this.close(CloseCodes.Unknown_opcode);
 		return;
diff --git a/src/gateway/opcodes/VoiceServerPing.ts b/src/gateway/opcodes/VoiceServerPing.ts
new file mode 100644
index 00000000..f684cb33
--- /dev/null
+++ b/src/gateway/opcodes/VoiceServerPing.ts
@@ -0,0 +1,9 @@
+import { Payload, WebSocket } from "@fosscord/gateway";
+import { Send } from "../util/Send";
+
+export async function onVoiceServerPing(this: WebSocket, data: Payload) {
+	console.log("Got voice server ping: ", data, "Doing a noop!");
+	
+
+	// return this.close(CloseCodes.Invalid_session);
+}
diff --git a/src/gateway/opcodes/index.ts b/src/gateway/opcodes/index.ts
index d5dc7de1..818d1597 100644
--- a/src/gateway/opcodes/index.ts
+++ b/src/gateway/opcodes/index.ts
@@ -6,6 +6,7 @@ import { onPresenceUpdate } from "./PresenceUpdate";
 import { onRequestGuildMembers } from "./RequestGuildMembers";
 import { onResume } from "./Resume";
 import { onVoiceStateUpdate } from "./VoiceStateUpdate";
+import { onVoiceServerPing } from "./VoiceServerPing";
 
 export type OPCodeHandler = (this: WebSocket, data: Payload) => any;
 
@@ -14,12 +15,14 @@ export default {
 	2: onIdentify,
 	3: onPresenceUpdate,
 	4: onVoiceStateUpdate,
-	// 5: Voice Server Ping
+	5: onVoiceServerPing, //Voice Server Ping
 	6: onResume,
 	// 7: Reconnect: You should attempt to reconnect and resume immediately.
 	8: onRequestGuildMembers,
 	// 9: Invalid Session
 	// 10: Hello
+	// 11: Heartbeat ACK
+	
 	// 13: Dm_update
 	14: onLazyRequest
 };