Send the canvas image when the client quits.

When a client quits, it is helpful to save the canvas image
and sends it back to the server for further examination. Saving
the canvas image from the client is useful because the python
server might not run on the same machine as the client.

To save the image, the client strips off the header of the base64
encoding of the png image, and the server converts it into binary
format before saving the file on the server side.

BUG=chromium:443539
TEST=Manually execute webplot.py on a chrome os machine.
Press 'q' on chrome to quit, or press ctrl-c to interrupt
the webplot server. The whole thing should be terminated
correctly in both ways.

Change-Id: I2546c37501987b29ef5b5e888ff14d59ecfc5e99
Reviewed-on: https://chromium-review.googlesource.com/242510
Reviewed-by: Charlie Mooney <charliemooney@chromium.org>
Commit-Queue: Shyh-In Hwang <josephsih@chromium.org>
Tested-by: Shyh-In Hwang <josephsih@chromium.org>
2 files changed
tree: 46b6d665fe935af0a0c569b36670d1e368e4f04a
  1. remote/
  2. webplot
  3. webplot.html
  4. webplot.js
  5. webplot.py