Archived
Introduce TypeScript client implementation for RCON Data Bridge v2 protocol with schema validation, adaptive polling, and batch request handling.
This commit is contained in:
1 parent
3f4a70ebfe
commit
dce67aae3e
15 files changed
+1385
-4
No files matched your search
@@ -92,6 +92,7 @@ local function onServerStarted()
|
||||
registerBaseOptions()
|
||||
registerOps()
|
||||
publishProtocolVersion()
|
||||
RDB_OpRegistry.setChangeListener(publishProtocolVersion)
|
||||
RDB_RequestPipeline.init()
|
||||
RDB_WorldStats.init()
|
||||
RDB_PlayerSnapshot.init()
|
||||
|
||||
+15
@@ -12,6 +12,19 @@ require("RconDataBridge/RDB_Constants")
|
||||
RDB_OpRegistry = {}
|
||||
|
||||
local handlers = {}
|
||||
local changeListener
|
||||
|
||||
-- Set once by RDB_Bootstrap so RconDataBridge_ProtocolVersion's `ops` list
|
||||
-- stays current when a plugin mod registers after bootstrap has run.
|
||||
function RDB_OpRegistry.setChangeListener(fn)
|
||||
changeListener = fn
|
||||
end
|
||||
|
||||
local function notifyChanged()
|
||||
if changeListener then
|
||||
changeListener()
|
||||
end
|
||||
end
|
||||
|
||||
-- def: { handler = function(args) -> ok, dataOrErrCode[, errMessage],
|
||||
-- argsSchema = {fieldName = "type", ...}, core = true|false }
|
||||
@@ -22,10 +35,12 @@ function RDB_OpRegistry.register(name, def)
|
||||
def.enabled = true
|
||||
end
|
||||
handlers[name] = def
|
||||
notifyChanged()
|
||||
end
|
||||
|
||||
function RDB_OpRegistry.unregister(name)
|
||||
handlers[name] = nil
|
||||
notifyChanged()
|
||||
end
|
||||
|
||||
function RDB_OpRegistry.isRegistered(name)
|
||||
|
||||
Reference in new issue
Block a user