Serving web pages and responding to HTTP requests

From Planimate Knowledge Base
Jump to navigation Jump to search

Planimate has a basic web server which will serve simple web pages but its primary purpose is to facilitate Planimate being triggered via a URL, the completion of forms etc.

It will not cope with heavy loads (or complex pages loading multiple images) as it doesn't multi-thread its processing of requests.

To start the server, select Edit/Sockets and enable the HTTP server. Its disabled by default. If you have IIS running on your machine (or any other program already using port 80 to serve) you will have to use a different port #.

Once running the server responds during edit and run mode.

1. At the moment, just entering the address of the machine (I'll use loopback here, 127.0.0.1, assuming local testing) will yield debug diagnostics.

http://127.0.0.1/

Eventually this will retrieve a model-default page instead and the debug will have a specific token to retrieve it.


2. Entering the name of a file in the current Planimate working directory (or a subdirectory thereof) will retrieve the file


http://127.0.0.1/index.htm -> retrieves index.htm if it exists


The server will only serve htm,gif,jpg and txt files, for security


3. Entering a parameterised string as follows will trigger a Planimate broadcast (the model must be running)


http://127.0.0.1/bc?name=mybroadcast&class=item&attribute1=12345


In this case broadcast "mybroadcast" will be sent using item class "item" and if an item attribute called "attribute1" exists, it will be set to 12345. Many attributes can be set using '&' to append further assignments.


If during processing a broadcast, the model creates/writes to _www.htm in its home directory, this file will be sent back to the client. Otherwise a default _www.htm is generated and served back.



idkbase note 46