Other Setups
- Luau
- Typescript
You can integrate YetAnotherNet into whatever game architecture you want by creating a Hook using Net.createHook({ Route })
which is identical to the Net.start(loop, { Route })
function. This function will return another function which you can call whenever you want to process your Routes' queues and send/receive your Packets on the Server or Client.
Below is a simple example of creating custom scheduling behavior using Net.createHook({ Route })
,
local RunService = game:GetService("RunService")
local Net = require("Net.luau")
local routes = require("routes.luau")
local hook = Net.createHook(routes)
RunService.Heartbeat:Connect(hook)
You can integrate YetAnotherNet into whatever game architecture you want by creating a Hook using Net.createHook({ route: Route })
which is identical to the Net.start(loop, { route: Route })
function. This function will return another function which you can call whenever you want to process your Routes' queues and send/receive your Packets on the Server or Client.
Below is a simple example of creating custom scheduling behavior using Net.createHook({ route: Route })
,
import { RunService } from "@rbxts/services";
import Net from "@rbxts/yetanothernet";
import routes from "shared/routes";
const hook = Net.createHook(routes);
RunService.Heartbeat.Connect(hook);