powered by Jive Software

How to Get authenticated Connection object


#1

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


#2

Take a look at line 81 and 86 :slight_smile:


#3

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


#4

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


#5

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.


#6

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


#7

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.


#8

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


#9

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