fix: default fqdn

This commit is contained in:
Linventif 2024-07-01 01:50:17 +00:00
parent 7b5a180ba5
commit 8ce3390666

View File

@ -72,13 +72,30 @@ function gmInte.websocketWrite(data)
end end
timer.Create("gmInte:WebSocket:CheckConnection", 4, 0, function() timer.Create("gmInte:WebSocket:CheckConnection", 4, 0, function()
if (!socket:isConnected()) then -- Check if the API is undergoing an update
if gmInte.isApiUpdating then
if socket:isConnected() then
gmInte.log("API Update detected, closing WebSocket connection.", true)
socket:close()
end
return
end
if socket:isConnected() then
-- Connection is already open, no need to do anything
-- Optionally, you can log this or handle it differently
else
socket:open() socket:open()
end end
end) end)
hook.Add("InitPostEntity", "gmInte:ServerReady:WebSocket", function() -- Example function to set the API update status
timer.Simple(1, function() -- This could be triggered by some condition or external input
socket:open() function gmInte.setApiUpdateStatus(isUpdating)
end) gmInte.isApiUpdating = isUpdating
end) if isUpdating then
gmInte.log("API Update starting, WebSocket connections will be managed accordingly.", true)
else
gmInte.log("API Update completed, WebSocket connections can resume normal operation.", true)
end
end