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.ts6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gateway/events/Connection.ts b/src/gateway/events/Connection.ts
index 41b2ff3d..fff5aacf 100644
--- a/src/gateway/events/Connection.ts
+++ b/src/gateway/events/Connection.ts
@@ -1,5 +1,5 @@
 import WS from "ws";
-import { WebSocket } from "@fosscord/gateway";
+import { genSessionId, WebSocket } from "@fosscord/gateway";
 import { Send } from "../util/Send";
 import { CLOSECODES, OPCODES } from "../util/Constants";
 import { setHeartbeat } from "../util/Heartbeat";
@@ -30,6 +30,10 @@ export async function Connection(
 
 	socket.ipAddress = ipAddress;
 
+	//Create session ID when the connection is opened. This allows gateway dump to group the initial websocket messages with the rest of the conversation.
+	const session_id = genSessionId();
+	socket.session_id = session_id; //Set the session of the WebSocket object
+
 	try {
 		// @ts-ignore
 		socket.on("close", Close);