property OnConnecting: TRVSocketEvent;
property OnConnected: TRVSocketEvent;
property OnConnectError: TRVSocketEvent;
property OnDisconnect: TRVSocketEvent;
OnConnecting occurs when the sender starts a connection to a server/receiver, or when a receiver starts a connection to the sender. See the topic about the modes of connections for the explanations.
After OnConnecting, either OnConnected or OnConnectError occurs.
OnConnected occurs on a successful connection. OnConnectError occurs on a failed connection.
OnDisconnect occurs on a disconnection.
If the sender starts a connection, MediaTypes parameter contains types of data that will be sent. Senders create new connections to send specific data, so this parameter always contain a single data type.
If a receiver starts a connection, MediaTypes is empty.
If you perform time-consuming operations inside an event, it makes sense to compare values of SessionKey parameter and SessionKey property, to make sure that a connection was not closed or reopened.