Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
jcdekoning #1
Member since Sep 2005 · 13 posts
Group memberships: Members
Show profile · Link to this post
Subject: How to know if user is connected?
I am creating a layer around the ag software xmpp library. The main function is SendMessage which sends a message to another user (not so impresive). When the user is not connected, the layer should connect to the server. After loggin in the message can be send.

My question is how can i decide when a user is connected. I looked at the ConnectionState but this is always Connecting, even when i am connected. I need to know this so that loggin in is only executed ones (or when the connection is lost).
Avatar
Alex #2
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
hi,

The connectionState is the current state of the library. Its just informational. The best would be to catch OnLogin and OnClose and store this in a local boolean variable in your wrapper.
I dont have a connected property yet, because its a bit more complicated in XMPP. There are lots of internal steps until you are really connected, authenticated and able to send messages.
If the XMPP session gets Disconnected to get OnClose.
When the Session is ready for sending messages you get OnLogin.

Alex
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP RSS