From 9582b41b569d6a8aa1e3dfd1ad511f1fdd8ea2b7 Mon Sep 17 00:00:00 2001
From: Linventif <linventif@gmail.com>
Date: Tue, 26 Sep 2023 16:24:07 +0200
Subject: [PATCH] ws auth

---
 lua/gmod_integration/server/sv_websocket.lua | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lua/gmod_integration/server/sv_websocket.lua b/lua/gmod_integration/server/sv_websocket.lua
index b71b552..f463a0e 100644
--- a/lua/gmod_integration/server/sv_websocket.lua
+++ b/lua/gmod_integration/server/sv_websocket.lua
@@ -2,12 +2,19 @@
 // WebSocket
 //
 
-if (!GWSockets) then return gmInte.logError("GWSockets not found!") end
+if (!gmInte.config.websocket) then return end
 
 require("gwsockets")
 
+if (GWSockets) then return gmInte.logError("GWSockets is not installed! Please install it from https://github.com/FredyH/GWSockets") end
+
 local socket = GWSockets.createWebSocket("wss://ws.gmod-integration.com")
 
+// Authentication
+socket:setHeader("id", gmInte.config.id)
+socket:setHeader("token", gmInte.config.token)
+
+// Dev
 function socket:onMessage(txt)
     print("Received: ", txt)
 end