Kodi Community Forum
Maximum size of JSON RPC batch requests - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93)
+---- Forum: JSON-RPC (https://forum.kodi.tv/forumdisplay.php?fid=174)
+---- Thread: Maximum size of JSON RPC batch requests (/showthread.php?tid=126412)



Maximum size of JSON RPC batch requests - nonpolar - 2012-03-24

Hi!

I am sending a batch request via JSON RPC.
If the requests exceed a certain size, I only get an empty HTTP 200 back. If I remove a couple of requests I get the expected answer back.

What's the maximum number of batch requests supported?

Thanks,
nonpolar



RE: Maximum size of JSON RPC batch requests - Montellese - 2012-03-24

It's probably not the number of JSON-RPC requests which is the limiting factor here but the number of characters in your HTTP request. I'll have to investigate to find the maximum possible size of a HTTP request. How many requests/characters are you sending which only gives you an empty HTTP 200 response?


RE: Maximum size of JSON RPC batch requests - Montellese - 2012-03-25

OK I checked the HTTP specification and there is no limit specified in there. It is up to the server to decide on a maximum size of the body of a POST request. I looked into XBMC's code and currently the maximum size is 20000 (20k) bytes but I doubt that your request contains that many characters?!

Could you provide the two batch requests you execute so I can see if I can reproduce the problem? Thanks.


RE: Maximum size of JSON RPC batch requests - nonpolar - 2012-03-25

First of all thanks for your support!

Your findings are matching mine - seems like the spec does not limit this. As far as I found out the browser and the technology employed on the server may impose other restrictions on the maximum length.

I will provide you an example, if that helps - basically I am sending a batch request to Files.PrepareDownload for getting all thumbnail URLs of all albums at once. Possibly this is a bad idea? :-)


RE: Maximum size of JSON RPC batch requests - Montellese - 2012-03-25

Currently you don't really need to call Files.PrepareDownload at all. All the download URL's are
Code:
http://<your-ip>:<your-port>/vfs/<url-encoded-thumbnail-path>

So just URL encode the path you get from JSON-RPC, prepend "/vfs/" and send that to XBMC's webserver and you should be fine.
This behaviour might change in the future but for now it works just fine.


RE: Maximum size of JSON RPC batch requests - nonpolar - 2012-03-25

I was thinking about that - but I thought better safe than sorry and use Files.PrepareDownload...


RE: Maximum size of JSON RPC batch requests - Montellese - 2012-03-25

I totally agree with you on this and I usually recommend using Files.PrepareDownload just to be on the safe side. I'm not sure if it makes sense to retrieve the URLs for all the paths in one batch request. That kind of eliminates the possibility to start downloading one album while looking up the URL for the next one which would allow lazy-loading of the images.


RE: Maximum size of JSON RPC batch requests - nonpolar - 2012-03-26

Hmmm.

I assumed that the "heavy" work rather is loading the images and I wanted to rely on the browser to handle that task in a performant way. The goal is, to show a searchable list of all albums having the correct thumnail path set - the thumbnails would then be loaded by the browser.
Using batch requests, I think loading the thumb paths should not result say in more than 10 batch requests à 100 paths. Not sure about the mean library size of albums though...

Lazy loading causes a lot of additional effort and in addition to that it's not possible anymore to search via JSON RPC. That's (and the lack of a mobile javascript ui list widget supporting lazy loading out of the box) why I wanted to load all paths at once.

I am getting off-topic... ;-)


RE: Maximum size of JSON RPC batch requests - joethefox - 2012-03-28

(2012-03-25, 22:14)Montellese Wrote: All the download URL's are
Code:
http://<your-ip>:<your-port>/vfs/<url-encoded-thumbnail-path>

So just URL encode the path you get from JSON-RPC, prepend "/vfs/" and send that to XBMC's webserver and you should be fine.
This behaviour might change in the future but for now it works just fine.

NOOO!!!! this is exactly how I get the thumbnails. When you say "This behaviour might change in the future", has this behaviour a lifetime and it will be marked as deprecated and then removed from the API or just one day it will disappearHuh



RE: Maximum size of JSON RPC batch requests - Montellese - 2012-03-28

No there's no specified lifetime. I'm just saying that the method Files.PrepareDownload is there for a reason and that one day in the future the "vfs/" path will be replaced by something else. If that ever happens it will probably be deprecated for a while i.e. the new way to access thumbnails will be made available while the existing one will also be available but no worries I won't just remove something like that without mentioning it.


RE: Maximum size of JSON RPC batch requests - joethefox - 2012-03-28

thanks for the answer that stop worrying me.