Version: 3.0.4

Using your definitions

Say that we have our example definition file here:

shared/remotes.ts
import Net, { Definitions } from "@rbxts/net";
const Remotes = Net.CreateDefinitions({
GetPlayerInventory: Definitions.ServerAsyncFunction<() => SerializedPlayerInventory>(),
GetPlayerEquipped: Definitions.ServerAsyncFunction<() => SerializedPlayerEquipped>(),
PlayerInventoryUpdated: Definitions.ServerToClientEvent<[event: InventoryUpdatedEvent]>(),
PlayerEquippedUpdated: Definitions.ServerToClientEvent<[event: EquippedUpdatedEvent]>(),
PlayerUnequipItem: Definitions.ClientToServerEvent<[itemId: number]>(),
PlayerEquipItem: Definitions.ClientToServerEvent<[itemId: number]>(),
});
export = Remotes;

How would we approach using this to actually be able to send messages between the server and client?

Usage#

server/main.server.ts
import Remotes from "shared/remotes";