Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > BOOK: Professional XMPP Programming with JavaScript and jQuery
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional XMPP Programming with JavaScript and jQuery
This is the forum to discuss the Wrox book Professional XMPP Programming with JavaScript and jQuery by Jack Moffitt; ISBN: 978-0-470-54071-8
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional XMPP Programming with JavaScript and jQuery section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old December 11th, 2010, 06:54 AM
Registered User
 
Join Date: Dec 2010
Posts: 2
Thanks: 0
Thanked 1 Time in 1 Post
Default Hello example connected user is always offline in openfire

Dear Author,

I really like your book. Ever since I learned the capability of XMPP your book is the 1st one that helps me understand how it works.

I was able to configure OpenFire on my own laptop and modified the Hello example to use local connection manager and connects to local OpenFire server. However, in the OpenFire admin console, I can see that the session made from the Hello.js is always shown as "Offline" under presence.

This is strange because if I make a connection using MatriX C# library, the user would show up online but if I make the connection using Strophe, it is always offline. Is there another command I have to call after Strophe's connection to make the user online?

What I am trying to do is to add a handler in Hello.js for so that when I send a message using a C# compiled executable, my web page will display that message.

Right now this doesn't work. When I send a message from C#, the web page displays nothing. It seems only able to handle messages from the server when I use the "send_ping" method from Strophe.

By the way, I did modify the Handler to use "null" for all the parameters so it should match and handle all stanza received from server. So maybe OpenFire simply doesn't send any stanza to Strophe connection due to the session is offline.

Thanks,
Jeffrey
  #2 (permalink)  
Old December 11th, 2010, 10:44 AM
Wrox Author
Points: 702, Level: 10
Points: 702, Level: 10 Points: 702, Level: 10 Points: 702, Level: 10
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2010
Posts: 178
Thanks: 0
Thanked 16 Times in 15 Posts
Default

Quote:
Originally Posted by babyfool View Post
I really like your book. Ever since I learned the capability of XMPP your book is the 1st one that helps me understand how it works.
Thanks! I'm glad you like the book, and I appreciate the feedback.

Quote:
This is strange because if I make a connection using MatriX C# library, the user would show up online but if I make the connection using Strophe, it is always offline. Is there another command I have to call after Strophe's connection to make the user online?
You can control whether you are online or offline by sending <presence> stanzas. Sending <presence/> will set you online and sending <presence type='unavailable'/> will set you offline. You can do this in Strophe with these commands:

Online:

Code:
connection.send($pres());
Offline:

Code:
connection.send($pres({type: "unavailable"}));
Quote:
What I am trying to do is to add a handler in Hello.js for so that when I send a message using a C# compiled executable, my web page will display that message.

Right now this doesn't work. When I send a message from C#, the web page displays nothing. It seems only able to handle messages from the server when I use the "send_ping" method from Strophe.

By the way, I did modify the Handler to use "null" for all the parameters so it should match and handle all stanza received from server. So maybe OpenFire simply doesn't send any stanza to Strophe connection due to the session is offline.
Messages will only get delivered to you if you are online. Otherwise the server with store them in offline message queue until you next come online.

My guess is that the C# library you are using automatically sends initial presence for you. There are plenty of cases where you don't want to send the initial presence immediately (for example if you want to set a negative presence priority), so Strophe doesn't make any assumptions about your intentions.
The Following 2 Users Say Thank You to metajack For This Useful Post:
mube84 (April 7th, 2011), wenchiching (August 21st, 2014)
  #3 (permalink)  
Old December 11th, 2010, 09:44 PM
Registered User
 
Join Date: Dec 2010
Posts: 2
Thanks: 0
Thanked 1 Time in 1 Post
Default

Thanks, after I send $pres() the user is online and is able to receive the messages sent from other client. This is excellent. Now I can push messages from my web server directly to the user instead of forcing the user to call an AJAX method every so many seconds to refresh a view.

Also, thanks for responding so fast to my question.
The Following User Says Thank You to babyfool For This Useful Post:
wenchiching (August 21st, 2014)
  #4 (permalink)  
Old August 21st, 2014, 09:56 AM
Registered User
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2014
Posts: 1
Thanks: 2
Thanked 0 Times in 0 Posts
Default

this save me from try and error for 5 hours, really thanks!
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
BOSH, Strophe, and Openfire iowadeifan BOOK: Professional XMPP Programming with JavaScript and jQuery 11 March 31st, 2014 03:08 PM
find if user /ip is connected ALEX_GRIM Classic ASP Professional 8 February 7th, 2005 01:36 AM
is this user on/offline? boolean db entry? ALEX_GRIM Classic ASP Basics 6 February 5th, 2005 05:30 AM
find if a user/ ip is connected ALEX_GRIM ASP.NET 1.0 and 1.1 Professional 6 February 3rd, 2005 11:53 PM



All times are GMT -4. The time now is 11:14 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.