Slideshow transcript
Slide 1: Windows Live Messenger Library Custom Presence
Slide 2: Custom Presence allows your web application to set custom presence properties on Messenger users Uses: Detect when two users are both signed into your custom Messenger application Enables sharing of rich presence information between users of your web application This allows you to ‘light up’ extra features between multiple users who are signed into your site
Slide 3: Create a presence extension object This object must support the g e t _ n a me ( ) method Other methods/data are up to you Create a PresenceExtensionFactory object with two methods: serialize(property): output a string representation of the presence extension object deserialize(name, content): recreate the presence extension from the string representation Set your PresenceExtensionFactory as the active presence factory Add the presence extension to users’ presence
Slide 4: This Presence Extension stores simple name/value pairs – they can be fancier var EXTENSION_NAME = ‘ExtNm’ // 6 chars or less function MyPresenceExtension(name, content) { this.name = name; this.content = content; } MyPresenceExtension.prototype.get_name = function() { return this.name; } MyPresenceExtension.prototype.get_content = function() { return this.content; }
Slide 5: This object serializes and deserializes your custom presence extension MyPresenceFactory = function () {} MyPresenceFactory.prototype.serialize = function(prop) { return prop.get_content(); } MyPresenceFactory.prototype.deserialize = function(name, content) { return new MyPresenceExtension(name, content); }
Slide 6: Add your presence factory to the user object user.set_presenceFactory(new MyPresenceFactory()); Add your presence extension to the signed-in user endpointColl = user.get_endpoints(); endpointPresence = endpointColl.get_item(0).get_presence(); extensionColl = endpointPresence.get_extensions(); extensionColl.add(new MyPresenceExtension(EXTENSION_NAME,'Content'));
Slide 7: For each contact, check their endpoints for the presence extension endpointEnum = address.get_endpoints().getEnumerator(); while (endpointEnum.moveNext()) { endpt = endpointEnum.get_current(); extEnum = endpt.get_presence().get_extensions().getEnumerator(); while (extEnum.moveNext()) { extension = extEnum.get_current(); if (extension.get_name() == EXTENSION_NAME) extensionContent = extension.get_content(); break; } }
Slide 8: Simple Demo app at http://wlmlcustompresence.mslivelabs.com demonstrates how to use Custom Presence Based on Hello World app (http://wlmlhelloworld.mslivelabs.com)
Slide 9: To see the demo, sign in to the site twice, with two different Live IDs (Works best with two different browsers i.e. IE + Firefox)
Slide 10: Users signed into the demo are assigned a custom presence extension If a contact in your list is signed into the same app, their status is shown with an asterisk * Contacts signed into the same demo site get a *
Slide 11: Demonstration App: http://wlmlcustompresence.mslivelabs.com/ SDK docs: http://msdn2.microsoft.com/en-us/library/cc298458.aspx More information at http://dev.live.com/messenger




Add a comment on Slide 1
If you have a SlideShare account, login to comment; else you can comment as a guest- Favorites & Groups
Showing 1-50 of 0 (more)