This page last changed on Aug 05, 2014 by noelhibbard.

I am trying to control the volume of a SqueezeBox player via an HTTP POST but it has about a 3 second lag. I can also control the volume via an HTTP GET and it doesn't have any lag at all. I really want to control it via a POST because I have more options via POST vs putting the parms on the URL and using GET. The lag is definitely caused by OpenRemote because I can generate a POST from other apps and there is no lag at all. Has anyone else noticed that HTTP POST is very slow in OpenRemote?

Took a quick glance at the source code and don't see anything specific to POST that might delay processing.

Depending on the version of the controller you're using, might be good to use the "ORCJAVA-400" patched version, mentioned in this How To : http://www.openremote.org/display/docs/OpenRemote+2.0+How+To+-+Philips+Hue

It fixes something on the HTTP protocol that caused issues with other products.

Otherwise, I do have a SqueezeBox player running, so I could try your command myself and see how it behaves.
Could you post the details on the URL and the payload used and I'll check ?

Posted by ebariaux at Aug 06, 2014 18:15

I will check out the version you are referring to. In the meantime, here is what I am trying to do:

URL:
http://<host>:<port>/jsonrpc.js

Method:
POST

Payload:

Unknown macro: {"id"}

So the host and port needs to be that of your LMS/SqueezeServer. You also need the MAC address of the player you want to change the volume of. The example above sets the volume to 0. Full volume would be 100. If you want to increase the volume 5% use +5. To drop 5% use -5. When I setup a command like this it takes about 3 seconds to execute. But I can generate a packet with windows PowerShell and it executes instantly. So I know the lag isn't coming from the SqueezeServer or SqueezePlayer.

Thanks for the response Eric!

Edit: Looks like my JSON is getting lost. Here is a pastebin of my payload: http://pastebin.com/raw.php?i=hyK2K7ju

Posted by noelhibbard at Aug 08, 2014 16:34

You should enclose your payload in a {code} section, that should work or escape the { character with a backslash.

I did a first quick test, having a mute command linked to a button and tested via the Web Console.

What I observed was that on the first press on the button, it took indeed something like 3 seconds, but after that it was nearly immediate (didn't do any timing but definitely below 0.5s).

Curious if you have the same experience or if you always experience a long delay?

When I get the time, I'll dig a bit more into why the initial delay is there.

Posted by ebariaux at Aug 09, 2014 09:03

This initial delay might be establishing new connection. Next time connection established for the first time is reused and you get an immediate response. This is only a guess, but usually it works this way in various libraries/languages including Apache HttpClient used in OR.

Posted by druciak at Aug 11, 2014 21:22
Document generated by Confluence on Jun 05, 2016 09:30