summary refs log tree commit diff
path: root/src/gateway/events/Connection.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/gateway/events/Connection.ts')
-rw-r--r--src/gateway/events/Connection.ts16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/gateway/events/Connection.ts b/src/gateway/events/Connection.ts
index ee75212f..d47ac314 100644
--- a/src/gateway/events/Connection.ts
+++ b/src/gateway/events/Connection.ts
@@ -12,7 +12,7 @@ import { Config } from "@fosscord/util";
 var erlpack: any;
 try {
 	erlpack = require("@yukikaze-bot/erlpack");
-} catch (error) {}
+} catch (error) { }
 
 // TODO: check rate limit
 // TODO: specify rate limit in config
@@ -39,6 +39,20 @@ export async function Connection(
 		// 	`[Gateway] New connection from ${socket.ipAddress}, total ${this.clients.size}`,
 		// );
 
+		if (process.env.WS_LOGEVENTS)
+			[
+				"close",
+				"error",
+				"upgrade",
+				//"message",
+				"open",
+				"ping",
+				"pong",
+				"unexpected-response"
+			].forEach((x) => {
+				socket.on(x, (y) => console.log(x, y));
+			});
+
 		const { searchParams } = new URL(`http://localhost${request.url}`);
 		// @ts-ignore
 		socket.encoding = searchParams.get("encoding") || "json";