Sign in

    gaato/discord/endpoint_http does not have a README file

    ServerConfigError

    pub(all) suberror ServerConfigError {
    InvalidMaxBodyBytes(value~ : Int)
    InvalidBodyTimeoutMs(value~ : Int)
    InvalidHeaderTimeoutMs(value~ : Int)
    InvalidMaxConnections(value~ : Int)
    } derive(
    Debug
    )

    Configuration rejected by serve_interactions before it starts listening.

    InteractionsServer

    pub struct InteractionsServer {
    // private fields
    }

    An HTTP server dispatching Discord interactions on native or moonrun Wasm.

    InteractionsServer::addr

    fn InteractionsServer::addr(self : InteractionsServer) -> String

    Return the actual listening address, including an OS-assigned port.

    InteractionsServer::close

    async fn InteractionsServer::close(self : InteractionsServer) -> Unit noraise

    Stop accepting requests and cancel active connection handlers.

    serve_interactions

    async fn[X] serve_interactions(group :
    TaskGroup
    [X], app :
    App
    , addr~ : String, public_key~ : String, access~ :
    RestAccess
    , application_id? :
    Id
    [
    ApplicationMarker
    ], path? : String, deadline_ms? : Int, max_body_bytes? : Int, body_timeout_ms? : Int, header_timeout_ms? : Int, max_connections? : Int) -> InteractionsServer

    Start a Discord HTTP-interactions server in group on native or moonrun Wasm.

    Use port zero in addr to let the OS choose a free port, then read the resolved address from InteractionsServer::addr.

    A request body larger than max_body_bytes gets 413, and one not received within body_timeout_ms gets 408; both close the connection. Discord's interaction payloads are far below the 1 MiB default. A connection whose next request head does not arrive within header_timeout_ms, idle keep-alive time included, is closed. At most max_connections clients are served at once; more wait to be accepted. Non-positive limits raise ServerConfigError before the server listens.

    Source Files