2 files changed, 12 insertions, 0 deletions
diff --git a/gateway/src/util/SessionUtils.ts b/gateway/src/util/SessionUtils.ts
new file mode 100644
index 00000000..1ca23316
--- /dev/null
+++ b/gateway/src/util/SessionUtils.ts
@@ -0,0 +1,11 @@
+export function genSessionId() {
+ return genRanHex(32)
+}
+
+export function genVoiceToken() {
+ return genRanHex(16)
+}
+
+function genRanHex(size: number) {
+ return [...Array(size)].map(() => Math.floor(Math.random() * 16).toString(16)).join('');
+}
\ No newline at end of file
diff --git a/gateway/src/util/WebSocket.ts b/gateway/src/util/WebSocket.ts
index d1e13555..2c763743 100644
--- a/gateway/src/util/WebSocket.ts
+++ b/gateway/src/util/WebSocket.ts
@@ -6,6 +6,7 @@ import { Channel } from "amqplib";
interface WebSocket extends WS {
version: number;
user_id: string;
+ session_id: string;
encoding: "etf" | "json";
compress?: "zlib-stream";
shard_count?: bigint;
|