MoneyWorks Manual
StartHTTPServer(handlerName, [port], [host])
Result type: handle
Definition: Starts an HTTP server. Requests to the server will be passed to your handler on the main UI thread, with the request headers passed as a parameter. You can specify a port to listen on. If you do not specify a port, an ephemeral port will be allocated. You can obtain the allocated port by calling GetHTTPServerPort(handle). You can stop the server by calling StopHTTPServer(handle). The server will be automatically stopped if your script is unloaded.
By default, the HTTP server will bind only to localhost, so connections can only be made from the same computer you are running on. If you pass a host parameter (anything except "127.0.0.1") then the server will bind to any IP on the machine and be accessible on the network. SSL is not supported. The server is intended for local use (such as for the MCP server)
Example
let server = StartHTTPServer("DoHTTPRequest")
Availablility: MoneyWorks Gold 9.2.5 and later. Does nothing in CLI (will return NULL)
See Also:
GetHTTPRequest: Get the HTTP request when processing a REST request on the server
GetHTTPRequestHeaders: Get the HTTP request headers when processing a REST request on the server
GetHTTPRequestPayload: Get the POST payload of an HTTP or REST request
GetHTTPServerPort: Get port of an HTTP server
PutHTTPRequestResponse: Put additional response information for an HTTP request
SSE_Send: Push SSE data to an HTTP client
StopHTTPServer: Stop an HTTP server