Version: 2.0.0

Net.Definitions Namespace

This namespace is for the Definitions feature.

Create(definitions)#

function Create<T extends RemoteDeclarations>(remotes: T): DefinitionBuilders<T>

Function

Example

shared/remotes.ts
import Net from "@rbxts/net";
const MyDefinitions = Net.Definitions.Create({
TestRemote: Net.Definitions.AsyncFunction<(name: string) => boolean>()
});

Function<Server>(...)#

Definition function for creating a FunctionDefinition

Event<ServerArgs, ClientArgs>(...)#

Definition function for creating an EventDefinition

AsyncFunction<Server, Client>(...)#

Definition function for creating an AsyncDefinition

Net.Middleware#

This namespace contains built-in middleware for RbxNet.

RateLimit(limit)#

RuntimeTypeCheck(...typeCheckers)#

DefinitionsCreateResult<T>#

Contains the definition builders for a given definition (returned using Create in Net.Definitions)

interface DefinitionsCreateResult<T extends RemoteDeclarations> {
readonly Server: ServerDefinitionBuilder<T>;
readonly Client: ClientDefinitionBuilder<T>;
}

Server#

A ServerDefinitionBuilder object.

Client#

A ClientDefinitionBuilder object.

ServerDefinitionBuilder<T>#

Contains all the definition builders for server-side events and functions.

class ServerDefinitionBuilder<T extends RemoteDeclaration> {
Create(name: string): ServerEvent | ServerAsyncFunction | ServerFunction;
ConnectEvent(name: string, callback: Callback): void;
}

Create(name)#

Will get the specified event by name, and return it. The returned object will be the type provided in the definition.

server/example.server.ts
import { Server as ServerRemotes } from "shared/remotes.ts";
const TestRemote = ServerRemotes.Create("TestRemote");

ConnectEvent(name, callback)#

Similar to Create but only works on events, and is pretty much a shortcut for Create(name).Connect(callback)

ClientDefinitionBuilder<T>#

Contains all the definition builders for server-side events and functions.

class ClientDefinitionBuilder<T extends RemoteDeclaration> {
Get(name: string): ServerEvent | ServerAsyncFunction | ServerFunction;
ConnectEvent(name: string, callback: Callback): void;
}

Get(name)#

Will get the specified event by name, and return it. The returned object will be the type provided in the definition.

Gets the specified remote definition and gets the client version of the event/function/asyncfunction

client/example.client.ts
import { Client as ClientRemotes } from "shared/remotes.ts";
const TestRemote = ClientRemotes.Get("TestRemote");

ConnectEvent(name, callback)#

Similar to Get but only works on events, and is pretty much a shortcut for Create(name).Connect(callback)