agent: Implement CockpitRestJson and the 'rest-json1' payload type

This is an implementation of the REST JSON payload type. It's fairly
complete, supporting streaming, monitoring, and other necessary
things.

Monitoring currently is only driven by an interval, where it could
also be driven off of output from another request.

Part of fix for #268, #267 and #265
web: Allow Channel.close() to accept a problem

Even though it's on the web side, we should allow Channel.close()
to accept a problem code which listeners can then react to. This allows
a consistent flow of problem codes no matter where they come from.
The problem code doesn't need to be sent to the web service or agent.
web: Use new rest-json1 protocol to implement web rest client
web: Add Rest.poll() and req.cancel() req.restart()

Add Rest.poll() function for setting up a REST JSON poll. In addition
we add the ability to restart() requests and cancel() them. The latter
are neccessary to restart the requests that the poll() is watching,
with the same cookie.
web: Use new REST functionality to watch Docker /events