0

I have a weird question. Is it possible to make a Retrofit network request to get back around 50k json data? Let's say the json looks like this:

{
  data: [
     {
      "Number":"323232",
      "Identifier":"1331332-1",
      "Price":"32000000",
      "Type":"Apartment",
      "Style":"",
      "SubType":"Double",
      "Beds":"1",
      "Baths":"1",
      "Furnished":"No",
      "Internet":"Yes",
      "Distance":"29700",
      "Picture":{
          "main":{
                 "url":"http://placehold.it/700x700"},
          "thumb":{
                 "url":"http://placehold.it/700x700"}
      }, ...
  ]
}

If possible to make a request to get all 50k in one sitting, how would one go about doing so and how fast would it be? I've tried limiting to only the information I need returned. But I've always gotten a SocketTimeOut exception. One thing I've thought up was to partition the amount of data I request into small chunks, and repeatedly make the network request until all 50k is gotten.

And if Retrofit is not designed for this purpose, what would be a good alternative? Volley? Or some other library?

David
  • 53
  • 1
  • 6
  • I believe you just need to adjust your timeouts. Try this: http://stackoverflow.com/q/29380844/1449657 – MrMannWood Nov 28 '16 at 03:45
  • @MrMannWood Thanks! I'm also requested that getting these 50k json data be very quick. I know that this is dependent on internet connection and server and all that. Is retrofit in any way responsible for how fast getting the data? – David Nov 28 '16 at 03:53
  • Yes, some libraries are faster than others. However, when dealing with network lag, the speed of a library isn't really important. 50k really isn't that much data, and you should be able to pull it in a single request without much latency. If speed is your primary concern, and you have control over the server, you could maybe split the calls into smaller return values (e.x. paging). However, doing so is not a silver bullet, and you will incur greater overall lag as you'll need new network handshakes for each call. – MrMannWood Nov 28 '16 at 14:51

0 Answers0