xbmc / Official-Kodi-Remote-iOS

Full-featured remote control for XBMC Media Center. It features library browsing, now playing informations and a direct remote control.
Other
224 stars 104 forks source link

Improvement: Faster connect to Kodi server #1163

Closed wutschel closed 1 month ago

wutschel commented 1 month ago

Description

This PR improves the time from App start or from manual server selection until the server is connected. Basically, this is done by two core changes:

  1. Loading the last server in AppDelegates's didFinishLaunchingWithOptions before initializing the main controllers for iPad and iPhone.
  2. Calling the heartbeat check method checkServer immediately before starting the repeating timer which calls checkServer.
  3. Trigger restart of timer by notification once a new server was selected.

To be able to show the HostManagement popover on iPad (e.g. no last server is defined or last server cannot be connected) the tcpJSONRPC is started in viewDidAppear.

As we are now connecting faster, the heartbeat timer can use a lower frequency. The timer was increased 5 seconds, and the connection timeout error kicks in after 4 seconds. This gives more time to the server to deal with potential high load situations, before the App is throwing error messages and signals a disconnect.

The videos show start to connect, followed by selecting a new server.

Summary for release notes

Improvement: Faster connect to Kodi server Improvement: More robust against connection loss in load situations on Kodi server

wutschel commented 1 month ago

Fixed comment and rebased to master.