Your Universal Remote Control Center
RemoteCentral.com
Philips Pronto Professional Forum - View Post
Previous section Next section Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Topic:
Can you leave a socket open?
This thread has 1 response. Displaying all posts.
Post 1 made on Sunday June 20, 2021 at 13:15
mpg7321
Regular Member
Joined:
Posts:
June 2020
109
So still working on a script for KODI. Was wondering if it was a good or bad idea to leave a socket open for feedback or even if its possible. Did some research on other remotes that use forums of Java scripting. Seems like there are two ways to get feedback from KODI. Some will ping the server on a set time interval such as every 5 seconds to receive feedback back from the server, others do seems to leave a socket open. So every time some thing changes on the server, the feedback instantly updates on the remote. Right now I am doing the ping method every 3 seconds and so far works good, got every thing I need done. Now just trying to clean things up and make it more efficient, seeing if there is a better way.

Thanks,
Mike
Post 2 made on Sunday June 20, 2021 at 13:38
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,992
Depends on what the server supports. If this is a JSONRPC api then the transport is likely HTTP-based. This being said, if you use the HTTP 1.1 protocol and don't specify a close connection header

Connection: close

Then the server may choose to keep the socket open. In certain cases, you can pipeline (send multiple) requests over the same socket waiting for a response after each request but your code has to process the Content Length response header such that it knows how to break apart each message.

There are other protocols such as the CometD/Bayeaux protocol that SqueezeCenter uses which support registering for 'events' on the server and when something changes, the server will send an event across the socket. CometD sends 'chunked' responses. I had to modify the Philips HTTP Library to support handling these types of responses so I know it works.

I have never used Kodi so don't know if it support asynchronous events or the protocol that it uses.
Lyndel McGee
Philips Pronto Addict/Beta Tester

Jump to


Protected Feature Before you can reply to a message...
You must first register for a Remote Central user account - it's fast and free! Or, if you already have an account, please login now.

Please read the following: Unsolicited commercial advertisements are absolutely not permitted on this forum. Other private buy & sell messages should be posted to our Marketplace. For information on how to advertise your service or product click here. Remote Central reserves the right to remove or modify any post that is deemed inappropriate.

Hosting Services by ipHouse