corda / net.corda.client.rpc.ext / RPCConnectionListener / onConnect

onConnect

abstract fun onConnect(context: ConnectionContext<I>): Unit

This method will be called to inform that RPC connection is established. ConnectionContext.connectionOpt will not be null.

If connection is lost RPC client will attempt to re-connect and if this is successful then this method will be called again with the same reference of ConnectionContext.connectionOpt as during initial connect. I.e. it is possible to say that once established ConnectionContext.connectionOpt stays constant during onConnect/onDisconnect cycles.