Skip to main content

TeleportDataServiceClient

This item only works when running on the client. Client

Client half of the symmetric teleport-data surface, mirroring TeleportDataService. Same build API (via a shared TeleportDataBuilder) and the same Promise-based read API, so a system queries arrived data the same way on either realm and gets the same answer.

The client holds the full arrived payload natively: TeleportService:GetLocalPlayerTeleportData() returns everything the player teleported in with, regardless of which realm set it. So the unified read (TeleportDataServiceClient.PromiseArrivedData) resolves immediately from local data -- no round-trip. Two things still cross the network:

  • the client replicates its raw arrived payload to the server on start, because the server's join data is blind to a client-initiated teleport; and
  • the client pulls its trusted band from the server (TeleportDataServiceClient.PromiseTrustedArrivedData), because the client cannot tell, from its own local data alone, which keys were server-authored.

Functions

RegisterTeleportDataProvider

TeleportDataServiceClient.RegisterTeleportDataProvider() → () → ()

Registers a shared provider. See TeleportDataBuilder.RegisterTeleportDataProvider.

RegisterPerPlayerTeleportDataProvider

TeleportDataServiceClient.RegisterPerPlayerTeleportDataProvider() → () → ()

Registers a per-player provider. See TeleportDataBuilder.RegisterPerPlayerTeleportDataProvider.

PromiseBuildTeleportData

TeleportDataServiceClient.PromiseBuildTeleportData(
players{Player},
baseData{[string]any}?
) → Promise<{[string]any}>

Builds the teleport data envelope for a teleport (typically { Players.LocalPlayer }, since a client can only teleport itself), awaiting any provider that returns a Promise. See TeleportDataBuilder.PromiseBuildTeleportData.

_getLocalUserId

TeleportDataServiceClient._getLocalUserId(_selfTeleportDataServiceClient) → number

Resolves the UserId used to select the local player's envelope slice. A method so tests can stand in a fixed id (a headless client has no Players.LocalPlayer), mirroring the server's _getUserId.

PromiseArrivedData

TeleportDataServiceClient.PromiseArrivedData(selfTeleportDataServiceClient) → Promise<{[string]any}?>

Returns the unified teleport data the local player arrived with, or nil. Resolves immediately: the client's local teleport data already contains everything the player arrived with (trusted keys included), so the merge is a no-op here. Mirrors TeleportDataService.PromiseArrivedData.

PromiseTrustedArrivedData

TeleportDataServiceClient.PromiseTrustedArrivedData(selfTeleportDataServiceClient) → Promise<{[string]any}?>

Returns the trusted-band teleport data the local player arrived with (server-authored), or nil. Pulled from the server, which alone knows which keys came through its join data. Mirrors TeleportDataService.PromiseTrustedArrivedData.

PromiseNonTrustedArrivedData

TeleportDataServiceClient.PromiseNonTrustedArrivedData(selfTeleportDataServiceClient) → Promise<{[string]any}?>

Returns the non-trusted-band teleport data the local player arrived with (its own local data), or nil. This is the band the client replicates to the server. Mirrors TeleportDataService.PromiseNonTrustedArrivedData.

PromiseArrivedValue

TeleportDataServiceClient.PromiseArrivedValue(
keystring
) → Promise<any>

Returns the unified value the local player arrived with under key, or nil.

PromiseHasArrivedValue

TeleportDataServiceClient.PromiseHasArrivedValue(
keystring
) → Promise<boolean>

Returns whether the local player arrived with a unified value under key.

PromiseTrustedArrivedValue

TeleportDataServiceClient.PromiseTrustedArrivedValue(
keystring
) → Promise<any>

Returns the trusted-band value the local player arrived with under key, or nil.

PromiseHasTrustedArrivedValue

TeleportDataServiceClient.PromiseHasTrustedArrivedValue(
keystring
) → Promise<boolean>

Returns whether the local player arrived with a trusted-band value under key.

PromiseArrivedValueIsTrusted

TeleportDataServiceClient.PromiseArrivedValueIsTrusted(
keystring
) → Promise<boolean>

Returns whether the unified value for key came from the trusted band. Mirrors TeleportDataService.PromiseArrivedValueIsTrusted.

SetNonTrustedArrivedTeleportDataForTesting

TeleportDataServiceClient.SetNonTrustedArrivedTeleportDataForTesting(
data{[string]any}?
) → ()

Overrides the local (non-trusted) arrived band. Test seam -- headless test clients have no real teleport data. Must be called before anything reads.

SetTrustedArrivedTeleportDataForTesting

TeleportDataServiceClient.SetTrustedArrivedTeleportDataForTesting(
data{[string]any}?
) → ()

Overrides the trusted band the client would otherwise pull from the server. Test seam -- headless test clients have no server to invoke. Must be called before anything reads.

SetTrustedFetchTimeoutForTesting

TeleportDataServiceClient.SetTrustedFetchTimeoutForTesting(
secondsnumber
) → ()

Sets the bounded wait for the server's trusted-band response. Test seam.

Show raw api
{
    "functions": [
        {
            "name": "RegisterTeleportDataProvider",
            "desc": "Registers a shared provider. See [TeleportDataBuilder.RegisterTeleportDataProvider].",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TeleportDataServiceClient"
                },
                {
                    "name": "provider",
                    "desc": "",
                    "lua_type": "TeleportDataProvider"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "() -> ()"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 106,
                "path": "src/teleportserviceutils/src/Client/TeleportDataServiceClient.lua"
            }
        },
        {
            "name": "RegisterPerPlayerTeleportDataProvider",
            "desc": "Registers a per-player provider. See [TeleportDataBuilder.RegisterPerPlayerTeleportDataProvider].",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TeleportDataServiceClient"
                },
                {
                    "name": "provider",
                    "desc": "",
                    "lua_type": "PerPlayerTeleportDataProvider"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "() -> ()"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 119,
                "path": "src/teleportserviceutils/src/Client/TeleportDataServiceClient.lua"
            }
        },
        {
            "name": "PromiseBuildTeleportData",
            "desc": "Builds the teleport data envelope for a teleport (typically `{ Players.LocalPlayer }`, since a client\ncan only teleport itself), awaiting any provider that returns a Promise. See\n[TeleportDataBuilder.PromiseBuildTeleportData].",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TeleportDataServiceClient"
                },
                {
                    "name": "players",
                    "desc": "",
                    "lua_type": "{ Player }"
                },
                {
                    "name": "baseData",
                    "desc": "",
                    "lua_type": "{ [string]: any }?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<{ [string]: any }>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 135,
                "path": "src/teleportserviceutils/src/Client/TeleportDataServiceClient.lua"
            }
        },
        {
            "name": "_getLocalUserId",
            "desc": "Resolves the UserId used to select the local player's envelope slice. A method so tests can stand in a\nfixed id (a headless client has no `Players.LocalPlayer`), mirroring the server's `_getUserId`.",
            "params": [
                {
                    "name": "_self",
                    "desc": "",
                    "lua_type": "TeleportDataServiceClient"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 149,
                "path": "src/teleportserviceutils/src/Client/TeleportDataServiceClient.lua"
            }
        },
        {
            "name": "PromiseArrivedData",
            "desc": "Returns the *unified* teleport data the local player arrived with, or nil. Resolves immediately: the\nclient's local teleport data already contains everything the player arrived with (trusted keys\nincluded), so the merge is a no-op here. Mirrors [TeleportDataService.PromiseArrivedData].",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TeleportDataServiceClient"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<{ [string]: any }?>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 167,
                "path": "src/teleportserviceutils/src/Client/TeleportDataServiceClient.lua"
            }
        },
        {
            "name": "PromiseTrustedArrivedData",
            "desc": "Returns the trusted-band teleport data the local player arrived with (server-authored), or nil. Pulled\nfrom the server, which alone knows which keys came through its join data. Mirrors\n[TeleportDataService.PromiseTrustedArrivedData].",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TeleportDataServiceClient"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<{ [string]: any }?>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 179,
                "path": "src/teleportserviceutils/src/Client/TeleportDataServiceClient.lua"
            }
        },
        {
            "name": "PromiseNonTrustedArrivedData",
            "desc": "Returns the non-trusted-band teleport data the local player arrived with (its own local data), or nil.\nThis is the band the client replicates to the server. Mirrors\n[TeleportDataService.PromiseNonTrustedArrivedData].",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TeleportDataServiceClient"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<{ [string]: any }?>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 191,
                "path": "src/teleportserviceutils/src/Client/TeleportDataServiceClient.lua"
            }
        },
        {
            "name": "PromiseArrivedValue",
            "desc": "Returns the unified value the local player arrived with under `key`, or nil.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TeleportDataServiceClient"
                },
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<any>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 202,
                "path": "src/teleportserviceutils/src/Client/TeleportDataServiceClient.lua"
            }
        },
        {
            "name": "PromiseHasArrivedValue",
            "desc": "Returns whether the local player arrived with a unified value under `key`.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TeleportDataServiceClient"
                },
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<boolean>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 219,
                "path": "src/teleportserviceutils/src/Client/TeleportDataServiceClient.lua"
            }
        },
        {
            "name": "PromiseTrustedArrivedValue",
            "desc": "Returns the trusted-band value the local player arrived with under `key`, or nil.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TeleportDataServiceClient"
                },
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<any>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 231,
                "path": "src/teleportserviceutils/src/Client/TeleportDataServiceClient.lua"
            }
        },
        {
            "name": "PromiseHasTrustedArrivedValue",
            "desc": "Returns whether the local player arrived with a trusted-band value under `key`.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TeleportDataServiceClient"
                },
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<boolean>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 248,
                "path": "src/teleportserviceutils/src/Client/TeleportDataServiceClient.lua"
            }
        },
        {
            "name": "PromiseArrivedValueIsTrusted",
            "desc": "Returns whether the unified value for `key` came from the trusted band. Mirrors\n[TeleportDataService.PromiseArrivedValueIsTrusted].",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TeleportDataServiceClient"
                },
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<boolean>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 261,
                "path": "src/teleportserviceutils/src/Client/TeleportDataServiceClient.lua"
            }
        },
        {
            "name": "SetNonTrustedArrivedTeleportDataForTesting",
            "desc": "Overrides the local (non-trusted) arrived band. Test seam -- headless test clients have no real\nteleport data. Must be called before anything reads.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TeleportDataServiceClient"
                },
                {
                    "name": "data",
                    "desc": "",
                    "lua_type": "{ [string]: any }?"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 275,
                "path": "src/teleportserviceutils/src/Client/TeleportDataServiceClient.lua"
            }
        },
        {
            "name": "SetTrustedArrivedTeleportDataForTesting",
            "desc": "Overrides the trusted band the client would otherwise pull from the server. Test seam -- headless test\nclients have no server to invoke. Must be called before anything reads.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TeleportDataServiceClient"
                },
                {
                    "name": "data",
                    "desc": "",
                    "lua_type": "{ [string]: any }?"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 294,
                "path": "src/teleportserviceutils/src/Client/TeleportDataServiceClient.lua"
            }
        },
        {
            "name": "SetTrustedFetchTimeoutForTesting",
            "desc": "Sets the bounded wait for the server's trusted-band response. Test seam.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "TeleportDataServiceClient"
                },
                {
                    "name": "seconds",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 311,
                "path": "src/teleportserviceutils/src/Client/TeleportDataServiceClient.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "TeleportDataServiceClient",
    "desc": "Client half of the symmetric teleport-data surface, mirroring [TeleportDataService]. Same build API\n(via a shared [TeleportDataBuilder]) and the same Promise-based read API, so a system queries arrived\ndata the same way on either realm and gets the same answer.\n\nThe client holds the full arrived payload natively: `TeleportService:GetLocalPlayerTeleportData()`\nreturns *everything* the player teleported in with, regardless of which realm set it. So the unified\nread ([TeleportDataServiceClient.PromiseArrivedData]) resolves immediately from local data -- no\nround-trip. Two things still cross the network:\n\n* the client **replicates** its raw arrived payload to the server on start, because the server's join\n  data is blind to a client-initiated teleport; and\n* the client **pulls** its *trusted* band from the server\n  ([TeleportDataServiceClient.PromiseTrustedArrivedData]), because the client cannot tell, from its\n  own local data alone, which keys were server-authored.",
    "realm": [
        "Client"
    ],
    "source": {
        "line": 21,
        "path": "src/teleportserviceutils/src/Client/TeleportDataServiceClient.lua"
    }
}