SoftAP HTTP Pages

The page callback function

When your page handler function is called, the system passes a result callback function as the cb parameter. The callback function takes these parameters:

  • cbArg: this is the cbArg parameter passed to your page callback function. It's internal state used by the HTTP server.
  • flags: presently unused. Set to 0.
  • status: the HTTP status code, as an integer, such as 200 for OK, or 404 for page not found.
  • mime-type: the mime-type of the response as a string, such as text/html or application/javascript.
  • header: an optional pointer to a Header that is added to the response sent to the client.

For example, to send a "not found" error for a page that is not recognized, your application code would call

//  EXAMPLE - send a 404 response for an unknown page
cb(cbArg, 0, 404, "text/plain", nullptr);