Title: sending messages from Server to Clients Post by: jackimed 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
Title: Re: sending messages from Server to Clients Post by: D.Tkalcec (RTC) 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 (http://realthinclient.com/sdkarchive/indexef7cef7c.html). ... and this old Topic from the RTC SDK Support Archive (http://www.realthinclient.com/sdkarchive/indexbd8bbd8b.html): Best Regards, Danijel Tkalcec |