Client

interface Client

Interface which duplicates AIDL client-side interface

In terms of NEXO Projects:

  • Server is a listener, which wait for commands from Client to handle and response to Client

  • Client is initiator which can send commands to Server and handles responses

Communication flow looks like this:

    Client[process A] Server[process B]
1. Client ─── connect ──► Server "saves it's reference on side of process A"
2. Server ◄── bind ─── Client "saves it's reference on side of process B"
3. Client ─── calls ──► Server::onMessage
4. Server ─── handles message: String ──► Result ──┐

5. [calls ──► Client::onMessage]

6. Responses to client◄──┘

Reconnection flow has two cases:

1. Connection was not established from first connecting
2. Connection was lost during communication

There are two types of policy of resolving this issue:

  • Reset - resets the connection

  • Reconnect - tries to reconnect to server again with configurable amounts of tries with configured timeouts

  • For Reconnection flow 1 - default policy Reset

  • For Reconnection flow 2 - default policy Reconnect. If after retries connection was not re-established, Client will try to connect to Server when it have new command

Functions

Link copied to clipboard
abstract fun getApplicationName(): String
Link copied to clipboard
abstract fun getClientVersion(): String
Link copied to clipboard
abstract fun getPackage(): String
Link copied to clipboard
abstract fun getProtocolVersion(protocolName: ProtocolName): String?
Link copied to clipboard
abstract fun notifyEvent(event: Event)
Link copied to clipboard
abstract fun onMessage(message: String?)

message handler

Link copied to clipboard
abstract fun requestForeground()

This method would be called by remote application, once it would require Client's application to become foreground.

Link copied to clipboard

This method would be called by remote application, once it would require Client's application to become foreground.