mirror of
https://github.com/gmod-integration/lua.git
synced 2025-03-16 23:27:35 +00:00
fix: default fqdn
This commit is contained in:
parent
7b5a180ba5
commit
8ce3390666
|
@ -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
|
Loading…
Reference in New Issue
Block a user