Route Integration
Add compress = true to any route's options table and App compresses the response automatically — the client decompresses it with no API changes needed.
How to enable
Pass { compress = true } as the third argument to any route method:
-- Server
app:Get("map/data", function(req, res)
res:Send(largeMapTable)
end, { compress = true })
Client side
The Network module detects a compressed response and decompresses it before handing data to your callback. Your client code does not change — res.data is already the original table. The response sets compressed = true so you can confirm compression was applied:
-- Client | data is already decompressed
network:Get("map/data", nil, function(res)
print(res.compressed) -- true
loadMap(res.data)
end)
Leaderboard example
-- Server: large leaderboard payload, compress on the way out
app:Get("leaderboard/top100", function(req, res)
local entries = BuildTop100() -- big table
res:Send(entries)
end, { compress = true })
-- Client: identical call, transparent decompression
network:Get("leaderboard/top100", nil, function(res)
RenderLeaderboard(res.data)
end)
No client API change
Compression is a server-side decision. You can add or remove compress = true from a route at any time without touching client code.
See also
← Codec · Compress | manual LZ77 and LZH compression · Decompress | restore a compressed buffer · App | route registration and options · Inventory Example | large payload compression