Test Results

About us

 Server to client message sending
Total posts: 3
 Author Server to client message sending
David Perkins

16.06.2009 16:42:47
Registered user

Although I purchased RTC 3 years ago, it's only now that I'm in a position to actually make use of it and I'd like to confirm whether it could do the following please:

I'd like clients to log in to the server and to request data.  Fine so far.  Periodically I would like the server to send the clients updates without the clients having to continually poll the server.  Can RTC/http handle this type of communications?


Danijel Tkalcec [RTC]

16.06.2009 17:05:24
Registered user
Hi David,

since you need a connection made from a Client to the Server if you want the Server to be able to send anything to the Client, there will need to be a connection active and the client will need to poll the Server for data.

But ... you can reduce the number of requests and traffic by using "DelayedCalls".

What you would do, basically, is start with a standard client polling the server periodically. Then, you can extend the functionality by using the TRtcDelayedCall objects to put a remote function call "to sleep" and wake the call up to send a response only after new data became available - instead of immediately responding with "no data here" when there is nothing to send.

There are a few threads in the RTC SDK Support section and a few in the RTC SDK FAQ which explain the basics of "delayed calls" in the RTC SDK (enter "delayed calls" in the Google Search box above to find them), but the best possible example you can find for the use of delayed calls is the RTC Messenger demo.

The RTC Messenger Client is continually "polling" the RTC Messenger Server for new information, while RTC Messenger Server uses "delayed calls" to send data to the Client when there is something available. The RTC Messenger Server will put  a remote function into a "delayed" state and store a "Delayed call" object into a pool from which the remote function can be "waken up" when there is data available for sending.

Using a 30 second timeout for the delayed call object, if there is no new data available for sending, timeout will trigger and the server will send a "no data available" response to the client. And if there is new data for the client, the function which has just prepared data for sending (for example, putting it into our sending queue) can wake the "sleeping remote call" up to check the "queue" and send the data out.

Best Regards,
Danijel Tkalcec
David Perkins

16.06.2009 17:57:27
Registered user
Thanks for the detailed explanation, I'll do a search for the Delayed Call threads