-
Notifications
You must be signed in to change notification settings - Fork 4
Callbacks
github-actions[bot] edited this page Apr 11, 2026
·
2 revisions
PawnREST uses callback-driven flow for upload events, outbound requests, and websocket clients.
- Declare callback signatures in your Pawn code (typically as
forwardfor global callbacks). - Per-request callbacks are named dynamically when you call
REST_Request,REST_RequestJSON,REST_WebSocketClient, orREST_JsonWebSocketClient. - In most gamemode setups, callbacks should return
1.
forward OnIncomingUploadCompleted(
uploadId,
routeId,
const endpoint[],
const filename[],
const filepath[],
const crc32[],
crcMatched
);forward OnIncomingUploadFailed(uploadId, const reason[], const crc32[]);forward OnIncomingUploadProgress(uploadId, percent);forward OnOutgoingUploadStarted(uploadId);
forward OnOutgoingUploadProgress(uploadId, percent);
forward OnOutgoingUploadCompleted(uploadId, httpStatus, const responseBody[], const crc32[]);
forward OnOutgoingUploadFailed(uploadId, errorCode, const errorType[], const errorMessage[], httpStatus);OnOutgoingUploadFailureDetailed is the structured variant with typed metadata (PAWNREST_ERR_*, error type string, and HTTP status when available).
public YourTextCallback(requestId, httpStatus, const data[], dataLen)public YourJsonCallback(requestId, httpStatus, nodeId)forward OnRequestFailure(requestId, errorCode, const errorType[], const errorMessage[], httpStatus);public YourSocketTextCallback(socketId, const data[], dataLen)public YourSocketJsonCallback(socketId, nodeId)forward OnWebSocketDisconnect(socketId, bool:isJson, status, const reason[], reasonLen, errorCode);status is the websocket close code; errorCode maps to PAWNREST_ERR_* for transport/parser failures.