{"id":"ncxyzero/bifrost","name":"bifrost","scope":"ncxyzero","platform":"roblox","description":"Bifrost is a compact networking library for Roblox","version":"0.0.2","latest":"0.0.2","versions":["0.0.1","0.0.2"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{},"integrity":"74c38d5eefc724eec27280049f5f32ecf8cdad07fe7cead05c835282877f96c3","likes":0,"downloads":0,"install":"forest install ncxyzero/bifrost","url":"https://forest.dev/p/roblox/ncxyzero/bifrost","files":"https://api.forest.dev/ai/package/roblox/ncxyzero/bifrost/files","readme":"# Bifrost\n\nA compact networking library for Roblox, inspired by [BridgeNet2](https://github.com/ffrostfall/BridgeNet2). Bridges share one `RemoteEvent`; function bridges share one `RemoteFunction`.\n\n## Install\n\nAfter publishing the package:\n\n```toml\n[dependencies]\nBifrost = \"ncxyzero/bifrost@0.0.2\"\n```\n\n## Bridges\n\n```luau\nlocal Bifrost = require(game.ReplicatedStorage.Packages.Bifrost)\nlocal bridge = Bifrost.Bridge(\"Bridge\") :: Bifrost.ServerBridge\n\nbridge:Connect(function(player, a, b)\n\tbridge:Fire(player, a + b, a - b)\nend)\n```\n\nOn the client:\n\n```luau\nlocal Bifrost = require(game.ReplicatedStorage.Packages.Bifrost)\nlocal bridge = Bifrost.Bridge(\"Bridge\") :: Bifrost.ClientBridge\n\nbridge:Connect(function(sum, difference)\n\tprint(sum, difference)\nend)\n\nbridge:Fire(1, 2)\n```\n\nServer targets also include `Bifrost.AllPlayers()`, `Bifrost.Players({ playerA, playerB })`, and `Bifrost.PlayersExcept({ playerA })`. Calling `Fire` on the server without a target broadcasts to all players. Bridges support `Connect`, `Once`, and `Wait`; tuples preserve `nil` values.\n\n## Function bridges\n\n```luau\nlocal inventory = Bifrost.FunctionBridge(\"Inventory\")\n\ninventory:OnInvoke(function(player, itemId)\n\treturn { owned = true, id = itemId }\nend)\n```\n\nOn the client, call `inventory:Invoke(itemId)` for a response or `inventory:InvokeAsync(itemId, function(ok, result) ... end)` to keep the caller running. `Invoke` accepts and returns tuples. Async calls time out after 10 seconds by default. `Invoke` yields only its calling thread while the `RemoteFunction` responds.\n\n## Data\n\nBifrost packs strings with `string.pack`, uses compact integer tags, and converts common Roblox types such as vectors, CFrames, and colors to numbers. It also supports tables, buffers, and replicated `Instance` references. Vector components and CFrame positions use 32-bit floats; CFrame angles use 16-bit integers.\n\nUse `Bifrost.ReferenceIdentifier(\"key\")` on both sides for repeated keys or values. Event calls made in one frame are batched per recipient. Bridge names and identifiers use deterministic 4-byte IDs, without UUID generation.\n","readmeTruncated":false}