Skip to content

net

luau
local net = require("@lute/net")

WARNING

These APIs are still open to future evolution. In new major versions, they may change in backwards incompatible ways.

Summary

EntryDescription
ConfigurationConfiguration for starting an HTTP server.
HandlerA request handler function: receives a ReceivedRequest and Server, and returns a ServerResponse.
MetadataHTTP request metadata, including optional method, body, and headers.
ReceivedRequestAn HTTP request received by the server, containing method, path, body, query params, and headers.
ResponseAn HTTP response, containing status code, headers, body, and a success flag.
ServerA running HTTP server handle, with hostname, port, and lifecycle methods.
ServerResponseA response that can be returned from a server handler: a plain string body, or a table with status, body, and headers.
ServerWebSocketA server-side WebSocket connection handle.
WebSocketA client-side WebSocket connection handle.
WebSocketHandlersEvent handlers for server-side WebSocket connections.
WebSocketOptionsOptions for establishing a WebSocket connection, including optional event handlers.

Types

Configuration

Configuration for starting an HTTP server.

luau
type Configuration = server.Configuration

Handler

A request handler function: receives a ReceivedRequest and Server, and returns a ServerResponse.

luau
type Handler = server.Handler

Metadata

HTTP request metadata, including optional method, body, and headers.

luau
type Metadata = client.Metadata

ReceivedRequest

An HTTP request received by the server, containing method, path, body, query params, and headers.

luau
type ReceivedRequest = server.ReceivedRequest

Response

An HTTP response, containing status code, headers, body, and a success flag.

luau
type Response = client.Response

Server

A running HTTP server handle, with hostname, port, and lifecycle methods.

luau
type Server = server.Server

ServerResponse

A response that can be returned from a server handler: a plain string body, or a table with status, body, and headers.

luau
type ServerResponse = server.ServerResponse

ServerWebSocket

A server-side WebSocket connection handle.

luau
type ServerWebSocket = server.ServerWebSocket

WebSocket

A client-side WebSocket connection handle.

luau
type WebSocket = client.WebSocket

WebSocketHandlers

Event handlers for server-side WebSocket connections.

luau
type WebSocketHandlers = server.WebSocketHandlers

WebSocketOptions

Options for establishing a WebSocket connection, including optional event handlers.

luau
type WebSocketOptions = client.WebSocketOptions