local funsaac = RegisterMod("funsaac", 1) local json = require("json") local requestServerInfo = { Id = 1, ClientName = "Funsaac v.0.0.1", MessageVersion = 3 } local client = require("websocket").new("127.0.0.1", 12345) function client:onmessage(message) print(message) end function client:onopen() local msg = '[{"RequestServerInfo": ' .. json.encode(requestServerInfo) .. "}]" print(msg) self:send(msg) end local function onUpdate() client:update() end funsaac:AddCallback(ModCallbacks.MC_POST_UPDATE, onUpdate)