AbortRemoteRequest

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 12:48, 24 August 2026 by QCherry (talk | contribs) (Document asynchronous server-side HTTP API)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

abortRemoteRequest

Requests cancellation of an HTTP request owned by the current server-side resource.

Syntax

bool abortRemoteRequest(number requestId)

Parameters

Name Type Required Description
requestId number yes The identifier returned by requestRemote.

Returns

Returns true when the owned request exists and cancellation was requested; otherwise returns false.

Examples

Cancel a request that is no longer needed:

local requestId = requestRemote(url, function(body, info)
    if info.aborted then
        outputDebugString("Request cancelled")
    end
end)

if requestId then
    abortRemoteRequest(requestId)
end

Notes

  • Available only in server-side resource scripts.
  • A resource can cancel only its own requests.
  • Cancellation is cooperative. The completion callback is still delivered with info.aborted = true when the resource remains running.
  • Stopping a resource cancels all HTTP requests owned by that resource and discards their callbacks.