Skip to content

Simple HTTP Api

Donald Mull Jr edited this page Sep 23, 2013 · 5 revisions

GET /

Same as `GET /index.html'

GET /{static file}

Return file contents (for included scripts, styles, alternate layouts, etc).

The server responds with the appropriate Content-Type and the body. No length need be specified.

Example:

HTTP/1.1 200 OK
Content-Type: text/html

<!DOCTYPE html>
<html>
    ....
</html>

Supported Types / Extensions

  • .html: Content-Type: text/html
  • .css: Content-Type: text/css
  • .js: Content-Type: text/javscript

GET /drawUpdates.js

Return the draw script to catch up since the last time this was requested.

POST /events/{name}

Informs server of a client event (e.g. 'click'). Arguments come in the body encoded in application/x-www-form-urlencoded (like url query params).

The server responds to all well-formed events with

HTTP/1.1 200 OK

Events

POST /events/click: x=0&y=0

POST /events/rightclick: x=0&y=0