INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: JSON Webservice  (Read 2266 times)

PaulSinnema

  • Galactic Citizen
  • ****
  • Posts: 393
  • You don't know what you're missing until its gone
JSON Webservice
« on: May 02, 2012, 02:48:52 pm »

Hi,

I would like make a suugestion. Until now I've been using the Webservice that sends responses in XML form. XML is a protocol with a big overhead. This format is, although flexible, not very efficient. JSON on the other hand offers a much more efficient way of data transfer. With fast networks there is no need to change from XML to JSON but on handheld devices that rely on WLAN connections any reduction would be welcome.

Another possibility could be GZipping the response. This would reduce the XML traffic considerably.

Regards
Paul
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42442
  • Shoes gone again!
Re: JSON Webservice
« Reply #1 on: May 02, 2012, 03:06:28 pm »

Another possibility could be GZipping the response. This would reduce the XML traffic considerably.

If you add the header "Accept-Encoding: gzip" to your requests, the XML data will be compressed.

Only packets longer than 1024 bytes will get compressed, but of course the response headers will specify the encoding, if any, used.

This was added in 15.0.160 (12/1/2010)
Faster: Servers that power DLNA, WebPlay, Gizmo, etc. will use gzip compression for clients that support it.
Logged
Matt Ashland, JRiver Media Center

PaulSinnema

  • Galactic Citizen
  • ****
  • Posts: 393
  • You don't know what you're missing until its gone
Re: JSON Webservice
« Reply #2 on: May 03, 2012, 08:07:52 pm »

Hi Matt,

Cool. I request a change to find out it has already been implemented. You guys have done a lot of cool stuff, thanks.

I'll try and implement the GZip thing. A concern I later thought of could be that the processpower of handheld devices could be too limited for a lot of GZip processing. But it's worth a try.

Regards
Paul
Logged

PaulSinnema

  • Galactic Citizen
  • ****
  • Posts: 393
  • You don't know what you're missing until its gone
Re: JSON Webservice
« Reply #3 on: May 06, 2012, 11:16:36 pm »

Hi Matt,

Very cool indeed. Adding the header starts the compression. In the images you can see the compression ratio of two sessions with and without compression. The effect is clear. Compression is up to 50% and you can also see the average size and max size of packages shrunk considerably. Now I have to test this on the real thing. I'll let you know how that goes. Thanks again.

Regards
Paul
Logged
Pages: [1]   Go Up