Server Connection Model
Data model that stores all relevant information about the current server connection. Also handles server discovery and heartbeats.
Accessed through ServerConnectionViewModel.
Types
All potential messages that can be sent to mHandler
Functions
Connects to the server with the given url.
Calls discoverServersOnNetwork to discover all available servers on the network, passes onServerURLsGet as a callback.
Returns the interval in which heartbeatRunnable/discoverRunnable should be called.
Calls sendHeartbeatRequest if the application is currently connected to a server; Passes onHeartbeatFail as a callback.
Checks if a given hostname is already known (= has been connected to before)
Callback that gets executed when the current connection status changes. Updates isDiscovering&isHeartbeating and calls either startDiscoverThread or startHeartbeatThread depending on newConnectionState
Callback that gets executed when sending a heartbeat fails. Calls onConnectionChanged to update the connection state
Callback that gets executed when new servers have been discovered via discoverServersOnNetwork.
Replaces the current serverUrlList with the provided serverUrlList
Starts discoverRunnable
Starts heartbeatRunnable
Stops all runnables
Automatically connects to the first known server in serverUrlList.
Helper function to update serverUrlList with newServers
Properties
Runnable that discovers all available servers on the network.
Runnable that calls heartbeat in an interval of getRunnableInterval ms.