RTC Forums
November 24, 2024, 03:09:38 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: sending messages from Server to Clients  (Read 4324 times)
jackimed
Newbie
*
Posts: 1


« on: November 21, 2013, 05:43:09 PM »

How can I send a message from server to client, I am saving the user name and session ID for all active sessions now how do I send a message to a user from the server using the session ID. a Chat program will be a good example when one user send a message to another user the server need to forward the message. I know a timer can be used on the client side to ping the server and check for new messages, but if I already have an active session and I know the session id for that user I should be able to send the message. I just started using RTC SDK I hope there is an easy answer to this
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 on: November 21, 2013, 06:43:57 PM »

Sessions have nothing to do with communication or connections. In order to send a message to any Client, the Server needs an active connection with that Client and there has to be an active Rrequest from that Client waiting for a Response from the Server. In short, for the Server to be able to send anything to a Client, the Client has to send a request to the Server to ask for that information. The Server does not have the capability to open a connection to a Client, nor does the Server has the possibility to send a message to the Client without being asked for it explicitly by the Client.

Check the RTC_Messenger Demo to see how delayed calls can be used with RTC remote functions to implement a long polling mechanism, which makes it possible for the Clients to get an instant response from the Server if there is data waiting, or delay the response until there is data available for the Client.

You might also want to check this topic from the RTC SDK FAQ Archive.

... and this old Topic from the RTC SDK Support Archive:


Best Regards,
Danijel Tkalcec
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.024 seconds with 17 queries.