The callback principle is simple, open a thread (in order to distinguish the other threads, this thread named "Channel Thread"), register a "lightweight" callback, and then this thread (channel thread) and other server return information (callback), the server has information returned, the channel thread then open a thread to execute the user registration callback ( Tdbxcallback) of the Execute method. The channel thread returns the callback information for the server that continues to wait.
Tdsclientcallbackchannelmanager.broadcast
Tdsclientcallbackchannelmanager.notifycallback
These two methods can send information to other clients through the server, and the Notifycallback method can receive the reply information from other clients. Both methods establish a new connection to the server when sending the message (which can be monitored at the server). Immediately after sending the message, disconnect. Frequent delivery may have an impact on the service program. When the program exits, it will connect again, disconnect 2-3 times, perform some finishing operations, such as logout channel.
Tdsclientcallbackchannelmanager registered callbacks, which are called "Heavyweight" callbacks on the demo or document. (In the demo before XE7, it seems to be the whole other demo)
When we need to communicate or broadcast messages to other clients, it is best to include a method in the service program, called by the client program to implement the broadcast of the message, rather than through Tdsclientcallbackchannelmanager.
XE7 's demo takes this approach. This reduces the number of connection disconnects to the service program and increases the performance of the server.
Inner realization of DelphiXE7 Datasnap Tdsclientcallbackchannelmanager