Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > BOOK: Professional XMPP Programming with JavaScript and jQuery
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 11th, 2010, 07: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
 
Old December 11th, 2010, 11:44 AM
Wrox Author
 
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)
 
Old December 11th, 2010, 10: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)
 
Old August 21st, 2014, 09:56 AM
Registered User
 
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!





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 02:36 AM
is this user on/offline? boolean db entry? ALEX_GRIM Classic ASP Basics 6 February 5th, 2005 06:30 AM
find if a user/ ip is connected ALEX_GRIM ASP.NET 1.0 and 1.1 Professional 6 February 4th, 2005 12:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.