How to Get authenticated Connection object

Hi team,

I have recently upgrade smack to version 4.3.0 stable version.

I am looking a way to get a authenticated connection object but could not found much help outside so asking a silly question here.

Is there any way to get authenticated connectino object from smack so i can use it anywhere in my application?

Please let me know if this possible it will decrese lot of overhead for me. @Flow @gdt @Paul_Schaub .

Thanks,
Hiren vavadiya

Take a look at line 81 and 86 :slight_smile:

i got your point but i will have to preseve it right with my application life cycle is there any way using which smack returns me connection object which was authenticated like it give some methods to check.

connection.isAuthenticated()
connection.isConnected()

Thanks,
Hiren Vavadiya

I dont understand your question, but yes, those methods do exist :smile:

i am expecting a method using which i get connection object from smack like below

ConnectionManager.getConnection();

This method should return last authenticated connection object established by smack.

are you getting me this time?

sorry for the condusing questions.

Ah now I get you.
Why don’t you create a singleton for that?

i did it as of now but i was curious is that any function avaible so i need not to manage singleton.

thanks for you suggestion.

I don’t think so. Smack is designed with the usecase of having multiple connections, so the user has to deal with them themselves.

hm that’s what i was thinking and that could be the reason anyway now i have to deal with singleton.