Ideal Place to Put Connection object

After long time absent in developing XMPP stuffs am back with an assignment. So I wanted to hear your opinions on something that I have to decide. Thanks for all who will take their time to say something.

I need to make a basic chat feature in an app. I can do that fine. But am not sure where I should put the connection. My instinct are, I should make a singleton accessible from application class and initialized there. But am not sure if that is great idea.

Anybody who thinks singleton is a bad idea? What else is out there? I will appreciate your inputs.

App is written in Kotlin/Compose. That is, Android

This topic was automatically closed 62 days after the last reply. New replies are no longer allowed.