Appearance
Architecture
The flake-android-sdk divides into multiple layer of detail and tasks. In the following, each layer will be shortly introduced.
FlakeClient
The FlakeClient represents the top layer and provide only the necessary functions for the user to interact with flakeConnection
The Connection is one layer beneath the FlakeClient and acts as a controller of the protocol. It manages the incoming messages, errors, etc. It gets its information from the transport layer.Transport
The Transport layer buffers all incoming Bytes and converts them into readable messages, which then gets forwarded to the Connection Layer.Wire
The Wire Layer is the lowest layer and handles the connection with the flake router. It reads / writes data as bytes directly to the stream and also open / closes connections.
Some of the layers interact with other helper objects:
FlakeObject
The FlakeObject gets created with receiving the reply of a queryObjects message and represents a service / object of the flake router. It is the second major element of the SDK, with that the user is interacting. Further detail later.Message
The message object represents a flake message described in the original flake protocol documentation and contains all the information as MessageType, toke, source-/ and destination address etc. It gets parsed from and to Bytes by the transportation layer.MessageHandler
The message handlers are handling the incoming messages and decides what to do with them. The ping message handler for example automatically returns a ping response when one gets received. The most used message handler is the reply message handler. When the SDK / User sends a message, a callback gets registered in the reply message handler for this message (identified by the token). If a message with the same token gets received (alias the messages reply) the callback gets called.
The following image shows a rough overview of the structure: