heroiclabsnakama-defold
heroiclabs/nakama-defold/nakama.engine.defold
Defold engine adapter for the Nakama client: UUID, HTTP, and realtime socket helpers.
- GitHub: heroiclabs/nakama-defold — pinned to
v3.4.0- Pick a release from heroiclabs/nakama-defold releases and add its Source code (zip) URL (or a packaged
.zipasset, if the library ships one) togame.projectunder[project]dependencies, then Fetch Libraries in the Defold editor. - Run
bunx @defold-typescript/cli resolveto materialize its types. - Import it under a namespace alias of your choice:
import * as engine_defold from "nakama.engine.defold"
- Pick a release from heroiclabs/nakama-defold releases and add its Source code (zip) URL (or a packaged
Functions
uuid(): stringhttp(config: unknown, url_path: string, query_params: string, method: string, post_data: string, retry_policy: unknown, cancellation_token: unknown, callback: (response: unknown) => void)socket_create(config: unknown, on_message: (socket: symbol, message: unknown) => void)socket_connect(socket: symbol, callback: (success: boolean, error: string) => void)socket_send(socket: symbol, message: string)
uuid(): stringU
Returns a UUID from the device's mac address.
Returns
string— The UUID string.
http(config: unknown, url_path: string, query_params: string, method: string, post_data: string, retry_policy: unknown, cancellation_token: unknown, callback: (response: unknown) => void)U
Make a HTTP request.
Parameters
config:unknown— The http config table, see Defold docs.url_path:string— The request URL.query_params:string— Query params string.method:string— The HTTP method string.post_data:string— String of post data.retry_policy:unknowncancellation_token:unknowncallback:(response: unknown) => void— The callback function.
socket_create(config: unknown, on_message: (socket: symbol, message: unknown) => void)U
Create a new socket with message handler.
Parameters
config:unknown— The socket config table, see Defold docs.on_message:(socket: symbol, message: unknown) => void— Your function to process socket messages.
socket_connect(socket: symbol, callback: (success: boolean, error: string) => void)U
Connect a created socket using web sockets.
Parameters
socket:symbol— The socket table, see socket_create.callback:(success: boolean, error: string) => void— The callback function.
socket_send(socket: symbol, message: string)U
Send a socket message.
Parameters
socket:symbol— The socket table, see socket_create.message:string— The message string to send.