> Since files should be streamed, as they could be enormous and not fitting in
> memory, I'd want to keep it out of the json stream
yes. small binary data may fit into json and json-rpc; but for large blobs
of data it's probably sensible to send them as a "raw" stream.
so, I would suggest to tell the server that you want to upload some data
by calling a json-rpc-method, which replies with an
url/ip+port/etc. where to upload the data, e.g.
--> {"jsonrpc": "2.0", "method": "send_image", "params": ..., "id": 1}
<-- {"jsonrpc": "2.0", "result": {"URL": "/exampleurl", "maxsize": 10000000, "accepted-format":["jpg", "png"]}, "id": 1}
--> send data directly to the remote server
and maybe to check if the data arrived correctly:
--> {"jsonrpc": "2.0", "method": "send_done", "params": {"checksum": "1a5e8f13"}, "id": 2}
<-- {"jsonrpc": "2.0", "result": "ok"}
I think that's the most simple and cleanest solution.
regards,
Roland
I'd agree with some sort of technique that allows you to simply post
the data to a URL. We occasionally get reports of memory problems
when people upload large files in WordPress via XML-RPC, the base64
encoding/decoding can be a beast.
--
Joseph Scott
jos...@josephscott.org
http://josephscott.org/