property OnConnecting: TRVSocketEvent;
property OnConnected: TRVSocketEvent;
property OnConnectError: TRVSocketEvent;
property OnDisconnect: TRVSocketEvent;
OnConnecting occurs when a sender starts a connection to the receiver, or when the receiver starts a connection to a sender/server. 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 is empty.
If the receiver starts a connection, these events are called in the process of opening channels for a specific data type, so MediaTypes parameter contains a single data type, identifying the channel.
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.