RTC Forums
April 29, 2024, 01:52:12 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: DelayedCalls block any other call from the same connection ?  (Read 3768 times)
HelgeLange
RTC Expired
*
Posts: 100


« on: May 13, 2015, 05:18:19 PM »

Hi Danijel,

I implemented my callback through DelayedCalls instead of a callback connection to the client.
I have a server that hosts several databases and normally some 50-100 clients connect to it using one of the databases.
Now sometimes the users posts a job (which I changed from an own implementation last night to serialized TRtcQuickJobs). When the Quickjob is done, all clients using the same database as the quickjob needs to be informed about the result. Before I used a callback connection but I changed it this morning to DelayedCalls. It works great and is easy to implement (as most of the RTC stuff), but I noticed something :

I have 1 function that informs the server that a job has to be done and in which database.
Then I have another function that gets the result through the delayed call. It has a delay of 30 seconds.

the first function comes in only when the delayed call is returning to the caller, like it's stuck.

Is multi-threaded a solution for that problem ? I rather ask, before I change everything to multi-threaded in code

Thanks in advance,
Helge
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 on: May 13, 2015, 05:47:04 PM »

That is correct.

When using DelayedCalls, you need a dedicated connection. The whole idea behind Delayed Calls is to send a request to the Server and keep the connection open, without sending a response, until the Server has Data ready to be sent back (a response), or a timeout occures. Because the Server needs a connection from the Client ready to receive a response immediately when a Result is ready, the connection can NOT be used for any other kind of communication when it is being used for a Delayed Call. So ... when you are working with Delayed Calls, you will always need at least two separate connections. One for the DelayedCall and the other one for making all other kinds of remote calls to the Server.

Best Regards,
Danijel Tlakcec
Logged
HelgeLange
RTC Expired
*
Posts: 100


« Reply #2 on: May 13, 2015, 06:26:35 PM »

So multi threaded will not work at all? Only a secondary connection ?
The connection is another HttpServer or just another ServerModule ?

Helge
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #3 on: May 13, 2015, 07:35:22 PM »

MultiThreaded has nothing to do with it. The Server also does NOT require changing. This is a Client-side requirement. The Client needs a separate physical connection for use with DelayedCalls. A secondary dedicated TRtcHttpClient component on the Client, just for DelayedCalls, so there will be a separate physical connection from the Client to the Server for making remote function calls where DelayedCalls are used on the Server.

Check the RTC Messenger Client and Server Demos if you need a hands-on example.

Best Regards,
Danijel Tkalcec
Logged
HelgeLange
RTC Expired
*
Posts: 100


« Reply #4 on: May 13, 2015, 07:40:26 PM »

Ok, thanks, that helps

Done, works like a charm. Cannot tell you enough how much code and work your components save me. Really good work!
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.03 seconds with 17 queries.