fix: failed connection spam

This commit is contained in:
Linventif 2024-03-29 14:23:10 +01:00
parent 797aabd3cf
commit 3210d70554
No known key found for this signature in database
GPG Key ID: FAC0CA60F9AEEC24

View File

@ -40,7 +40,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")
end end
// log on message // log on message
@ -56,10 +56,18 @@ function socket:onMessage(txt)
end end
function socket:onDisconnected() function socket:onDisconnected()
gmInte.log("WebSocket Disconnected", true) gmInte.log("WebSocket Disconnected")
end end
local lastConnectError = 0
function socket:onError(txt) function socket:onError(txt)
if (string.StartWith(txt, "Connection failed:")) then
if (CurTime() - lastConnectError < 5) then
return
end
gmInte.logError("WebSocket Error: " .. txt, true)
return
end
gmInte.logError("WebSocket Error: " .. txt, true) gmInte.logError("WebSocket Error: " .. txt, true)
end end