{"id":"studiorafa/jolt-clone","name":"jolt-clone","scope":"studiorafa","platform":"roblox","description":"High-performance networking for Roblox. A modern alternative to Warp.","version":"3.0.0","latest":"3.0.0","versions":["3.0.0"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{},"integrity":"5daa67e211a09f0b85fe28a7898de12d83361ecb1c0948a79bb2a536d2edbea0","likes":0,"downloads":0,"install":"forest install studiorafa/jolt-clone","url":"https://forest.dev/p/roblox/studiorafa/jolt-clone","files":"https://api.forest.dev/ai/package/roblox/studiorafa/jolt-clone/files","readme":"<div align=\"center\">\r\n  <h1>Jolt ⚡</h1>\r\n  <p>\r\n    <strong>High-performance networking for Roblox. Simplified.</strong>\r\n  </p>\r\n  \r\n  <a href=\"https://github.com/ToriumSlurs/jolt/blob/main/LICENSE\"><img src=\"https://img.shields.io/github/license/ToriumSlurs/jolt?style=flat\" alt=\"License\"></a>\r\n</div>\r\n\r\n---\r\n\r\n## 📖 About\r\n\r\n**Jolt** is a lightweight networking library designed to replace standard `RemoteEvent`, `UnreliableRemoteEvent` and `RemoteFunction` usage with a streamlined, strictly typed API.\r\n\r\nIf you have used the [Warp](https://github.com/imezx/Warp) networking library before, you will find Jolt's API very familiar. Since Warp has been archived, I wanted to create a modern, reliable alternative that developers can count on, including myself. \r\n## 🤝 Contributing & Feedback \r\nI am actively looking for help with: \r\n* **Testing:** properly testing the module, especially covering edge cases. \r\n* **Improvements:** suggestions or PRs to improve performance or usability. \r\n* **Bug Fixes:** identifying and fixing any issues that arise. \r\n\r\nIf you're interested in helping out or just want to use a maintained, high-performance networking library, please check it out!\r\n\r\n## ✨ Features\r\n\r\n* **⚡ Blazing Fast:** Zero-allocation packet handling via buffer serialization.\r\n* **🔒 Type Safe:** Full Luau type checking and autocomplete support.\r\n* **📦 Compact:** Automatic data compression and circular table support.\r\n* **🔄 Hybrid Networking:** Every event supports both reliable and unreliable messaging out of the box.\r\n* **🧘 Developer Friendly:** Simple, declarative syntax that gets out of your way.\r\n\r\n## 🚀 Usage\r\n\r\n### Server Example\r\n```lua\r\nlocal Jolt = require(path.to.Jolt)\r\n\r\n-- Create a new event\r\nlocal MyEvent = Jolt.Server(\"MyEvent\")\r\n\r\n-- Fire an event to a client\r\nMyEvent:Fire(player, \"Hello from the server!\")\r\n\r\n-- Listen for client events\r\nMyEvent:Connect(function(player, message)\r\n    print(player.Name, \"sent:\", message)\r\nend)\r\n\r\n-- Handle client invokes\r\nMyEvent.OnInvoke = function(player, data)\r\n\treturn \"Hello, \" .. player.Name .. \"!\"\r\nend\r\n```\r\n\r\n### Client Example\r\n```lua\r\nlocal Jolt = require(path.to.Jolt)\r\n\r\n-- Create a new event\r\nlocal MyEvent = Jolt.Client(\"MyEvent\")\r\n\r\n-- Listen for server events\r\nMyEvent:Connect(function(message)\r\n    print(\"Server sent:\", message)\r\nend)\r\n\r\n-- Fire an event to the server\r\nMyEvent:Fire(\"Hello from the client!\")\r\n\r\n-- Invoke the server\r\nlocal response = MyEvent:Invoke()\r\nprint(response) -- \"Hello, Player1!\"\r\n```\r\n\r\n### Server-to-Client Invocations\r\nJolt supports full round-trip invocations.\r\n\r\n```lua\r\n-- Server\r\nlocal MyInvoke = Jolt.Server(\"MyInvoke\")\r\nlocal success, response = pcall(function()\r\n    return MyInvoke:Invoke(player, \"Requesting data\")\r\nend)\r\n\r\n-- Client\r\nlocal MyInvoke = Jolt.Client(\"MyInvoke\")\r\nMyInvoke.OnInvoke = function(data)\r\n    return \"Processed: \" .. data\r\nend\r\n```\r\n\r\n### Unified Invocations\r\nJolt gives the ability to use an unified function to automatically get the correct environment\r\n\r\n*(can be used in things such as `ModuleScript`(s) for example)*\r\n\r\n```lua\r\n-- Server\r\nlocal MyEvent = Jolt.ReferenceBridge(\"MyEvent\") -- Gives the Server environment\r\nMyEvent:Connect(function(Player: Player, Data: string)\r\n    print(Data) -- \"Jolt from the client !\"\r\nend)\r\nMyEvent:Fire(Player, \"Jolt unified!\")\r\n\r\n-- Client\r\nlocal MyEvent = Jolt.ReferenceBridge(\"MyEvent\") -- Gives the Client environment\r\nMyEvent:Connect(function(data)\r\n    print(Data) -- \"Jolt unified!\"\r\nend)\r\nMyEvent:Fire(\"Jolt from the client !\") -- returns nil\r\n```\r\n\r\n### Disconnection & Resilience\r\nJolt is built to be resilient to script lifecycle changes. If a script is destroyed, its connections are **automatically cleaned up** to prevent memory leaks.\r\n\r\nHowever, if you need to stop listening while the script is still running, you can manually disconnect:\r\n\r\n```lua\r\nlocal connection = MyEvent:Connect(function(...)\r\n    print(\"Received event!\")\r\nend)\r\n\r\n-- Stop listening manually\r\nconnection:Disconnect()\r\n```\r\n\r\n### With Generics\r\nFor enhanced type safety, you can provide a type cast to your Jolt objects. The generic parameters are `<Args...>` for event/invoke arguments and `<Out...>` for invoke return values.\r\n\r\n```lua\r\n-- Server\r\nlocal myEvent = Jolt.Server(\"MyEvent\") :: Jolt.Server<{ Arg: string }>\r\nmyEvent:Fire(player, { Arg = \"Hello World\" })\r\n\r\nlocal myInvokeEvent = Jolt.Server(\"MyInvokeEvent\") :: Jolt.Server<(), (boolean, string)>\r\nmyInvokeEvent.OnInvoke = function(player)\r\n  return true, \"Success!\"\r\nend\r\n\r\n-- Client\r\nlocal myEvent = Jolt.Client(\"MyEvent\") :: Jolt.Client<{ Arg: string }>\r\nmyEvent:Connect(function(data)\r\n  print(data.Arg)\r\nend)\r\n\r\nlocal myInvokeEvent = Jolt.Client(\"MyInvokeEvent\") :: Jolt.Client<(), (boolean, string)>\r\nlocal success, message = myInvokeEvent:Invoke()\r\n```\r\n\r\n## 📦 Supported Types\r\n\r\nJolt automatically serializes the following types:\r\n\r\n* `nil`\r\n* `boolean`\r\n* `buffer`\r\n* `number`\r\n* `string`\r\n* `table`\r\n* `Instance`\r\n* `Vector3`\r\n* `Vector2`\r\n* `CFrame`\r\n* `Color3`\r\n* `BrickColor`\r\n* `Region3`\r\n* `EnumItem`\r\n* `UDim`, `UDim2`\r\n* `TweenInfo`\r\n","readmeTruncated":false}