Skip to main content
The root module is a façade. It holds no state, guards each constructor against the wrong context, and re-exports the Types namespace.

Members

function
Creates a server-side event channel. Server only.
function
Creates a client-side event channel. Client only.
Types namespace
The schema constructor namespace, identical to require(Flux.Utils.Types). See Types.
These three are the entire public surface. There is no ReferenceBridge, no unified constructor, and no Bridge, Buffers or Remotes re-export. Those modules exist but are internal.

Flux.Server()

string
required
The channel identifier. Both sides have to use the exact same string, and matching is case-sensitive. It is written into every packet, so short names cost fewer bytes.
{ Types.Type }
An optional positional array describing the event’s argument layout. When present, event payloads skip per-value type tags. See Schemas.
Server<Args..., Out...>
A server event object. See Server.
Errors with Flux.Server can only be called on the server. when called from a client. Use the shared-module pattern if the call site runs in both contexts.
The first call initialises the transport: it creates Flux_Reliable and Flux_Unreliable, starts the Heartbeat flush loop, and installs the OnServerEvent handlers. Requiring the root module does none of that on its own, so at least one Flux.Server(...) call has to run during server startup or clients will hang waiting for the remotes.

Flux.Client()

string
required
The channel identifier. Has to match the server’s exactly.
{ Types.Type }
An optional positional argument layout. Has to be identical to the server’s schema for the same name.
Client<Args..., Out...>
A client event object. See Client.
Errors with Flux.Client can only be called on the client. when called from the server.
The first client call resolves the remotes with WaitForChild, so it yields until the server has created them.

Exported types

Both types are generic over two type packs, each defaulting to (...any).
type pack
default:"(...any)"
The arguments the event carries.
type pack
default:"(...any)"
The values an invocation returns.

Asymmetries in the type definitions

These are not oversights. They reflect what Flux actually implements.
Because Server has no Invoke and Client has no OnInvoke, server-to-client invocation does not exist in Flux. Round trips run from client to server only. See Invocations for the two-event alternative.

Usage with generics

See Generics for the full treatment, including sharing packs between the two contexts.

Next steps

Server

Every server method in detail.

Client

Every client method in detail.