The bindings for Ubiquity and the TapServer must be very
simple.
- Determine what inputs are natural for Ubiquity
- Dispatch natural inputs to the Server
- Server returns a JSON with instructions for how to handle
results
Results should only be handled in a small variety of ways.
Currently:
- Inject a script into the DOM
- Run a script in Ubiquity (default if not JSON... the script
will simply evaluate?)
Examples:
{inject: true, script: blah}
{inject: false, script: blah}
{script: blah}
"blah" // may be a bad idea...
This provides maximum flexibility, without an explosion in
possibilities. Server-side a script can be made to inject HTML,
redirect, etc.
A server-side issue remains regarding how to dispatch requests
and generate the response JSON. Middleware may be the answer for
the default server.
- Default server gets wrapped in middleware that adds a flag:
env[tap.ubiquity] = true
- If response has header indicating JSON, then return
- If not, cache and send JSON asking for a redirect to pickup
cache (ie the request is made and a new tab is opened or the page
simply redirects)