HTTP Request Handling
Have your submodule handle HTTP requests sent to a special URL.
Submodule Code
This code only works on the Server side files since HTTP only works on servers, obviously!
You must return something, even if it's just a confirmation the data was received. Otherwise, the HTTP request will hang and eventually error on the client's side.
Breakdown
The framework exposes the RegisterPluginHttpEvent
function for plugins to use (is not exported, currently). Using this function "registers" a particular type where the framework will send the POSTed payload to the callback function.
Note: This will block the HTTP request, so take care if this is requesting data from an external source like a database.
To actually use this, we would POST to the URL, as noted below.
Return a LUA table which will be encoded as JSON back to the requesting client.
Submodule Event
POST
http://yourserverip:serverport/sonorancad/pluginevent
Send a payload to trigger a specific HTTP event that was defined in the submodule code.
Request Body
Last updated