Skip to main content

NetEvent

Network Event

Allows for client-server communication.

Base class that all the Roket networking functionality is based on.

Functions

Load

NetEvent.Load(optionsOrIdLoadOptions<TArgs> | string) → NetEvent

Types

interface LoadOptions {
Idstring
Unreliableboolean
Middlewares{
FireMiddlewares,
ListenMiddlewares
}
}

Load a Roket network event

Read more on the docs.

Fire

NetEvent.Fire(
selfNetEventInternals<TArgs>,
argsNetEvent_Fire_Args<TArgs>
) → NetEvent_Fire_Ret

Fire a network event

Listen

NetEvent.Listen(
selfNetEvent,
rawListener(argsNetEvent_Listen_Args<TArgs>) → ()
) → RBXScriptConnection

Listen to a network event

Show raw api
{
    "functions": [
        {
            "name": "Load",
            "desc": "Load a Roket network event\n\nRead more on the [docs](/docs/core_concepts/network_event).",
            "params": [
                {
                    "name": "optionsOrId",
                    "desc": "",
                    "lua_type": "LoadOptions<TArgs> | string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "NetEvent"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 57,
                "path": "src/roket/module/NetEvent.luau"
            }
        },
        {
            "name": "Fire",
            "desc": "Fire a network event",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "NetEventInternals<TArgs>"
                },
                {
                    "name": "args",
                    "desc": "",
                    "lua_type": "NetEvent_Fire_Args<TArgs>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "NetEvent_Fire_Ret\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 90,
                "path": "src/roket/module/NetEvent.luau"
            }
        },
        {
            "name": "Listen",
            "desc": "Listen to a network event",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "NetEvent"
                },
                {
                    "name": "rawListener",
                    "desc": "",
                    "lua_type": "(args: NetEvent_Listen_Args<TArgs>) -> ()"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "RBXScriptConnection\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 117,
                "path": "src/roket/module/NetEvent.luau"
            }
        }
    ],
    "properties": [],
    "types": [
        {
            "name": "LoadOptions",
            "desc": "",
            "fields": [
                {
                    "name": "Id",
                    "lua_type": "string",
                    "desc": ""
                },
                {
                    "name": "Unreliable",
                    "lua_type": "boolean",
                    "desc": ""
                },
                {
                    "name": "Middlewares",
                    "lua_type": "{ Fire: Middlewares, Listen: Middlewares }",
                    "desc": ""
                }
            ],
            "source": {
                "line": 44,
                "path": "src/roket/module/NetEvent.luau"
            }
        }
    ],
    "name": "NetEvent",
    "desc": "Network Event\n\nAllows for client-server communication.\n\nBase class that all the Roket networking functionality is based on.",
    "source": {
        "line": 21,
        "path": "src/roket/module/NetEvent.luau"
    }
}