MsgCommunicator: Delphi Instant Messaging (IM) SDK
for easy creation of custom messenger system
To learn general information about messaging, please read Messaging chapter first.
Direct messaging is used by default in client/server mode. When you send message to other on-line client for the first time, your client try to open direct connection which will be used for all further data exchange between these two clients.
If direct connection and messaging is allowed by TMsgClient.AllowDirectly property, Active property will be implicitly set to True when you call Connect or set Connected to True to establish a connection with a server. To forbid opening of direct connection (that is, to force client messaging through the server only), set AllowDirectly to False before calling Connect or set Active to False every time after Connect finished.
To prevent opening direct connection including by remote request, set TMsgClient.Active to False. This do not close opened connections, just forbid to open new ones.
To check is any opened direct connection, read TMsgClient.ConnectedDirectly property.
To close all existing connections including direct, call TMsgClient.DisconnectAll method.
How to test direct mode.
1. Compile Client and Server demos.
2. Run Server and 2 copies of Client application.
3. Connect both clients to server.
4. Register users.
5. Add one user to the contact list of other user and vice versa.
4. Send message from any client to other client from his contacts.
Now direct connection is open and all further communication will be processed directly. To be sure, you can even stop the server or close Server application. Despite there is no server anymore, clients can communicate. You can press Get Contact List button and see that another client is still on-line. Close a client to see that his status in contact list of other client changes to off-line.
If you do not plan to use server wholly, you should read Peer-To-Peer Mode chapter to learn features of this mode and to read an information on how to develop such an application.
Connecting, Login and Registration
User details and users database
Working with contact list
Writing server application