mirror of
https://github.com/gmod-integration/lua.git
synced 2025-03-15 22:07:34 +00:00
fix: failed connection spam
This commit is contained in:
parent
797aabd3cf
commit
3210d70554
|
@ -40,7 +40,7 @@ socket:setHeader("id", gmInte.config.id)
|
|||
socket:setHeader("token", gmInte.config.token)
|
||||
|
||||
function socket:onConnected()
|
||||
gmInte.log("WebSocket Connected", true)
|
||||
gmInte.log("WebSocket Connected")
|
||||
end
|
||||
|
||||
// log on message
|
||||
|
@ -56,10 +56,18 @@ function socket:onMessage(txt)
|
|||
end
|
||||
|
||||
function socket:onDisconnected()
|
||||
gmInte.log("WebSocket Disconnected", true)
|
||||
gmInte.log("WebSocket Disconnected")
|
||||
end
|
||||
|
||||
local lastConnectError = 0
|
||||
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)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user