28/10/2011

Presence Control in Web app

CodeProject
We have seen many ways of implementing presence control in our web application.
The simplest of all of them is a combination of Images with Java script.
Lets see how to implement it.

Before going to actual implementation, we have to answer a few questions.Why i need to use this one, i have my predefined reusable user controls for presence control ?
Ans: Yes, you can use them unless you answer below questions. i. Is it light weight? ii. Is it talking to your Messenger service or you want to take the overhead of communicating with exchange server? iii. Do you want to have complete control over the functionality and display? iv. Do you want to avoid the issues due to lack of complete information regarding references and bugs? v. Are you working on MVC Razor which cannot accommodate the heavy weight user controls designed in regular asp.net?

One of the answers will be this post.

This is nothing new written by me. The java script file i used is given by MS. But they have designed for purpose of demo, and i did some tweaks to make it work for my scenario.

Finally , don't forgot to keep the default scr or ImageUrl. Because if you look into Script file, it will just change the Image name at the end of image url in case of any status changes.Pros :
Automatically trace the changes in status.
Light weight
As MVC Razor renders only markup to client, we cannot use regular user controls, this is best option available for this kind of situation.
Faster, as this will talk to Messenger service provided by your communicator.

Cons:
This needs Communicator to be installed.
As it is not talking to exchange server, this cannot fetch status unless you are signed in.
This is a ActiveX Control based , so better use with IE.

"One good lesson i learned while doing this POC, unless you learn whats in there, you cannot use it. Either its script file or its a user control".
Code:Click Here
Is it helpful for you? Kindly let me know your comments / Questions.

4 comments:

Appreciate your code. I was wondering, is there a way where we could actually use custom images in place of the actual provided images. If yes, how? as I find it hard to find the source of these images in the code/package.