skip to main | skip to sidebar
Erlang and other cool things
XMPP and IM, Erlang and other functional languages, AWS and cloud; shameless promotion of my skills to prospective clients; sharing thoughts and experience with like-minded professionals.
Thursday, August 20, 2009
Real-time Web applications with XMPP: working demo
Yes, this is a mid-size demo web app with XMPP, more specifically, combination of Strophe, exmpp, ejabberd on Amazon EC2. The purpose of this exercise was to create a "proof of concept" and prepare myself for more serious projects. The demo is now available online , go ahead and check it out. You could either use predefined account (username: acc1, password : acc1), or register your own. Choose weather stations from right-hand panel and watch your browser being updated in a real time with data coming from (fake) weather service. Clicking on station's icon will toggle subscription, green arrow icon meaning the account is currently subscribed to that station. You will also see (normally quickly passing) blue icon meaning station is waiting for updated subscription status from the server. The demo is in early beta (if I can say this about demo at all), some features, such as live network status and live support are coming soon.
The app is very dynamic. Try this: open 2-3 windows with the same account and watch subscription changes you're making in one window instantly showing up in others. This is a nice feature that could be used for real-time collaboration. It's possible to imagine a number of applications that need real-time updates and collaborations of that sort: trader floors, stock tickers, asset tracking, order fulfillment, arrivals/departures, ticket reservations, chats, tweets, you name it.
It's not surprising that Google have chosen XMPP as core protocol for the Google Wave.
What's the big deal, you might ask? We have been using dynamic Ajax-based apps for a while now. This is a better Ajax, though, as it uses XMPP over HTTP (BOSH) protocol. You can read about it in details here and here. Briefly, most Ajax applications are using polling, which is poorly scalable and resource-hungry technique. Javascript libraries that employ BOSH, on the other hand, are using Ajax with "semi-permanent" connections, keeping them alive until server really has data to send to the client.
And, with Javascript libraries supporting BOSH, such as Strophe or jsJac, plus JQuery, "We Don't Need No Stinkin' Web Frameworks" :-)
The XMPP-specific features having been implemented/used in the demo:
* in-band registration;
* service discovery;
* roster push handlng;
* presence notifications and subscription handling.
In the next few days, I'll go over setting all things up on EC2, which is no small feat, at least it wasn't for me :-) I'm also planning to add some more features, such as self-restoring after disconnections and crashes, both on server and browser sides. As usual, your input is appreciated and welcomed.
The source (HTML/JavaScript) is available here.
P.S. Please remember this is a fake data, so don't use it for planning your weekends, although I have taken care not to show "Heavy Snow" icon during summer. I might be not that far off from official weather feeds, though :-) One day I might just take a real feed and turn that demo into something useful :-)
Posted by TAGSAHEAD at 10:09 PM
Labels: EC2, ejabberd, exmpp, Jabber, javascript, Strophe, XMPP
7 comments:
CUONGLB said...
Hey, your demo has been slow for me ! Try later ! :))
August 30, 2009 7:29 PM
TAGSAHEAD said...
Could you give me more details, please? Did you manage to register or used shared account? What browser/OS did you use? When it became sluggish - right at the start, while building tree, showing updates etc.?
Could well be slow first time though, there are some javascript libs to cache :-)
August 31, 2009 12:08 AM
Anonymous said...
Two thoughts:
1) Have you considered using disqus on this blog?
2) Will you be releasing any of the erlang code?
September 1, 2009 2:04 AM
TAGSAHEAD said...
1) Thanks for the suggestion, I like disqus and am planning to use it here.
2) Did you mean erlang code for the demo? It is available at https://tagsahead.svn.beanstalkapp.com/xmpp_component/trunk
September 1, 2009 8:55 AM
Salvador Fuentes said...
Great! Thanks.
September 1, 2009 8:20 PM
Sophie said...
This post has been removed by a blog administrator.
November 24, 2009 11:12 AM
Anonymous said...
This post has been removed by a blog administrator.
March 3, 2010 11:20 AM
Post a Comment
Links to this post
Create a Link
Newer Post Older Post Home
Subscribe to: Post Comments (Atom)
Subscribe Now:
Subscribe in a reader
About Me
Boris Okner
I've been a software developer since 1986. I make my living by consulting. I have seen and worked with many amazing and strange things, such as mainframes, Fortran, tapes, punched cards and disk devices size of dishwasher, and sometimes I'm telling my kids bedtime stories about all that stuff. Of course, they don't believe me :-).
View my complete profile
Blog Archive
* ► 2010 (3)
o ► February (2)
+ gen_client example walk-through
+ gen_client in action: fixing temporary subscriptio...
o ► January (1)
+ gen_client behaviour for building XMPP clients in ...
* ▼ 2009 (12)
o ► October (1)
+ How to make ejabberd cluster setup a bit easier
o ► September (2)
+ Erlang for Java programmer - Java can be good at t...
+ XMPP web demo: setting it up
o ▼ August (4)
+ XMPP web demo update
+ XMPP web project walk-through
+ Intermission: Erlang production nirvana
+ Real-time Web applications with XMPP: working demo...
o ► July (3)
+ XMPP gen_component update: Design and features
+ gen_component project: service discovery with exmp...
+ Writing XMPP components in Erlang with exmpp
o ► June (2)
+ Erlang for Java programmer - Design patterns, p.1
+ Erlang for Java programmer - power of functions
Followers