This commit is contained in:
Linventif 2023-09-26 21:51:13 +02:00
parent cd4c6d578c
commit 14ba02d0c1

View File

@ -15,7 +15,7 @@ socket:setHeader("id", gmInte.config.id)
socket:setHeader("token", gmInte.config.token) socket:setHeader("token", gmInte.config.token)
function socket:onConnected() function socket:onConnected()
gmInte.log("WebSocket connected", true) gmInte.log("WebSocket Connected", true)
end end
// log on message // log on message
@ -24,7 +24,7 @@ function socket:onMessage(txt)
end end
function socket:onDisconnected() function socket:onDisconnected()
gmInte.log("WebSocket disconnected", true) gmInte.log("WebSocket Disconnected", true)
end end
function socket:onError(txt) function socket:onError(txt)
@ -36,9 +36,7 @@ function gmInte.websocketSend(data)
end end
hook.Add("InitPostEntity", "gmInte:ServerReady:WebSocket", function() hook.Add("InitPostEntity", "gmInte:ServerReady:WebSocket", function()
if (gmInte.config.websocket) then socket:connect() end timer.Simple(1, function()
socket:open()
end)
end) end)
if (gmInte.config.debug) then socket:connect() end
print(gmInte.config.debug && "WebSocket Debug Mode" || "WebSocket")