Adapted controller to handle connection logic

This update is complementary commit which updates the controller code to handle connection logic by using the xmpp presence time to determine when to create a new connection.