04-messenger & presence

Upload: sivadon-chaisiri

Post on 30-May-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/14/2019 04-Messenger & Presence

    1/54

    1

  • 8/14/2019 04-Messenger & Presence

    2/54

    Overview

    Messenger Library

    Messenger IM Control

    Presence API Alerts

    Activities

    2

  • 8/14/2019 04-Messenger & Presence

    3/54

    Understand the strategic importanceof using Live Messenger in yourapplications

    Understand the various LiveMessenger components

    Know your development options for

    3

  • 8/14/2019 04-Messenger & Presence

    4/54

    Why Live Messenger? Compelling way for people to stay in

    touch

    300+ Million Users (worlds largest)

    30 Billion contact relationships #1 messaging service in most markets

    Grow audience and user base

    Increase stickiness of your site

    4

  • 8/14/2019 04-Messenger & Presence

    5/54

    Reach out to contacts

    Add new contacts

    Show what users are doing on yoursite

    Let users interact with rich messaging

    5

  • 8/14/2019 04-Messenger & Presence

    6/54

    6

  • 8/14/2019 04-Messenger & Presence

    7/54

  • 8/14/2019 04-Messenger & Presence

    8/54

    Enables third-party sites to seamlessly add instant messagingcapabilities with Windows Live Messenger

    Client-side library helps buildpresence-enabled Web applications

    Messenger Library applications can bebuilt in JavaScript or C# (using Script#)

    Sign-in with Windows Live ID; sign-incontrol hosted by Microsoft

    Interact with site visitors or other IMusers

  • 8/14/2019 04-Messenger & Presence

    9/54

    Messaging and Presence

    Build a custom Messengerexperience

    All of the core Windows LiveMessenger features are available

    Application Messages and CustomPresence allow value-addedfeatures

  • 8/14/2019 04-Messenger & Presence

    10/54

  • 8/14/2019 04-Messenger & Presence

    11/54

    JavaScript URL is http://www.wlmessenger.net/api/2.5/messenger.js

    Contact Properties1. Presence

    2. Display Name

    3. Nickname

    Endpoint Names

    Show/Hide Control

    All collections expose item accessors

    Firefox 3.0 support

    11

  • 8/14/2019 04-Messenger & Presence

    12/54

    Windows Live ID is required

    End users must grant permission to eachweb site that hosts a client library application The user may allow the site to sign them in to

    Messenger

    Browser support IE 6, 7 & 8

    Firefox 1.5, 2.0 & 3.0

    Safari 3.0

    12

  • 8/14/2019 04-Messenger & Presence

    13/54

    13

  • 8/14/2019 04-Messenger & Presence

    14/54

    Sign-in

    1. Instantiate Microsoft.Live.Messenger.UI.SignInControl2. Subscribe to the AuthenticationCompleted event

    3. Define event handler for AuthenticationCompleted1. Instantiate User object2. Subscribe to User.SignInCompleted

    3. Call User.SignIn4. Define event handler for User.SignInCompleted

    5. After authentication the User object is ready to use User Object

    1. Represents signed in user

    2. Provides access to users contact

    Channel and Privacy pages

    1. Required to host these pages

    2. Channel.htm used for cross-domain communication

    14

  • 8/14/2019 04-Messenger & Presence

    15/54

    Monitor the presence of the currentuser and the users contacts

    Iterate through each contact on the

    user's contact list1.Subscribe to the PropertyChanged event

    2.Subscribe to the ContactPresence

    15

  • 8/14/2019 04-Messenger & Presence

    16/54

    Use the User.OnlineContacts andUser.OfineContacts collections

    Setup CollectionChanged event handlers foreach collection

    Update the UI with the event handlers

    _user.get_onlineContacts().add_collectionChanged(onlineContacts_CollectionChanged);

    _user.get_ofineContacts().add_collectionChanged(ofineContacts_CollectionChanged);

    16

  • 8/14/2019 04-Messenger & Presence

    17/54

    Use the set_status function of thepresence object for the user

    _user.get_presence().set_status(Microsoft.Live.Messenger.PresenceStatus.online);

    17

  • 8/14/2019 04-Messenger & Presence

    18/54

    Get contact collection_contactCollection = _user.get_contacts();

    Subscribe toAddContactCompletedEventHandler

    _user.add_addContactCompleted(addContactCompleted);

    Add a Contact_user.addContact(address, 'Invitation message.',

    null);

    Remove a contactvar contact = _contactCollection.find(address,

    18

  • 8/14/2019 04-Messenger & Presence

    19/54

    Create an instance of a conversationvar imaddress = contact.get_currentAddress();_conv =

    _user.get_conversations().create(imaddress);

    Send a messagevar message = newMicrosoft.Live.Messenger.TextMessage(Amessage.", null);

    _conv.sendMessage(message, null);

    Listen for a message

    _conv.add_messageReceived(recvMsg); Track conversations

    19

  • 8/14/2019 04-Messenger & Presence

    20/54

    20

  • 8/14/2019 04-Messenger & Presence

    21/54

    Show a users presence User must give permission to share presence and

    receive messages

    HTTP based API Returns JSON or an image Can be used together with IM Control

    Supported browsers

    IE 6 or higher Firefox 1.5 or higher on Windows

    21

  • 8/14/2019 04-Messenger & Presence

    22/54

    Invite users with Signup URL

    1. http://settings.messenger.live.com/applications/websignup.aspx?returnurl=[URL]&privacyurl=[URL]

    Users will be returned to the return URL

    Must implement a privacy page

    Returned CID can be used by both the Presence API and the IMcontrol

    Query the Presence API using HTTP http://messenger.services.live.com/users/[ID]/[resource]/[?queryparameters]

    1. [ID] is numerical user ID

    2. [resource] specifies JSON or image

    22

  • 8/14/2019 04-Messenger & Presence

    23/54

    {

    "status": "Online",

    "icon":

    {

    "height": 16,

    "url": "http://settings.messenger.live.com/static/w13r2/Conversation/img/Status_Online.gif",

    "width": 16

    },

    "statusText": "Online",

    "id": "[email protected]",

    "displayName": "Name"}

    23

  • 8/14/2019 04-Messenger & Presence

    24/54

    cb query parameter - JSON1. http://messenger.services.live.com/users/

    [email protected]/presence/?cb=ShowStatus&mkt=en-US

    Presence image from an HTML element

    1.

    24

  • 8/14/2019 04-Messenger & Presence

    25/54

    25

    Element Description

    status Online, Away, Idle, BeRightBack, Busy,

    statusText The user's status as a localized string.

    id The ID that was passed in to the API call.

    displayNam The Messenger display name of the user.mkt Specifies a culture ID indicating the language.

    icon References an icon representing the users

    icon.url The URL of the status icon image.

    icon.width The width of the status icon image in pixels.

    icon.height The height of the status icon image in pixels.

  • 8/14/2019 04-Messenger & Presence

    26/54

    26

  • 8/14/2019 04-Messenger & Presence

    27/54

  • 8/14/2019 04-Messenger & Presence

    28/54

    Navigate to:

    http://settings.messenger.live.com/applications/websettings.aspx

    Select the Allow websites to see your Messenger

    status and send you messages check box andclick Save

    Under Web Settings, click Create HTML

    Copy the HTML and paste it into your Web page

    28

  • 8/14/2019 04-Messenger & Presence

    29/54

    Add a link to the signup page.

    User goes to WLM settings page.

    Redirect back to the web site

    Use the users ID with the IM control

    29

  • 8/14/2019 04-Messenger & Presence

    30/54

    http://settings.messenger.live.com/applications/WebSettings.aspx

    30

  • 8/14/2019 04-Messenger & Presence

    31/54

  • 8/14/2019 04-Messenger & Presence

    32/54

    SOAP Protocol

    Programmatic Integration Add/Remove group Publication sign-up Subscribe/Unsubscribe end-user Deliver message Inquire about user subscription Inquire about available groups

    32

  • 8/14/2019 04-Messenger & Presence

    33/54

    33

  • 8/14/2019 04-Messenger & Presence

    34/54

    Partner Identification Each Alerts Partner is provided with a unique

    PIN and password. The PIN and password are required in all

    message transmissions to Alerts. Partner IP

    Alerts validates each request against aspecified list of legal IP addresses. This listof addresses must be supplied to Alerts and

    verified before the site can operate inproduction mode.

    34

  • 8/14/2019 04-Messenger & Presence

    35/54

    Testing URIs Message: http://services.alerts.live-ppe.com/axis/services/Message

    Subscription:http://services.alerts.live-ppe.com/axis/services/Subscription

    Production URIs Message: http://services.alerts.live.com/axis/services/Message

    Subscription:http://services.alerts.live.com/axis/services/Subscription

    Alerts Manager URLs Test:http://signup.alerts.live-ppe.com/login/editLoginPIN.do

    Production:http://signup.alerts.live.com/login

    End-user Signup URLs

    Test: http://signup.alerts.live-ppe.com/alerts/login.do?PINID=&returnURL=

    Production: http:// signup.alerts.live.com/alerts/login.do?

    35

  • 8/14/2019 04-Messenger & Presence

    36/54

  • 8/14/2019 04-Messenger & Presence

    37/54

    A Messenger Activity is a Web application page thatprovides an interactive experience for Windows LiveMessenger users

    Activities can be multi-user applications takeadvantage of the Messenger communicationinfrastructure

    Users start Activities from the Games or theActivities buttons in a conversation window, orexternally from a webpage.

  • 8/14/2019 04-Messenger & Presence

    38/54

    Example: Windows Live Search Activity

  • 8/14/2019 04-Messenger & Presence

    39/54

    Example: Windows Live Search Activity

  • 8/14/2019 04-Messenger & Presence

    40/54

    Getting Started

    Start with a new or existing HTML page. The HTMLpage will be displayed within the Windows LiveMessenger client

    The largest window that the Windows Live Messenger

    client can display is 500 by 500 pixels

    Event handlers and functions are placed in thescripting part of the document

    Output and information are displayed in the bodypart of the document.

  • 8/14/2019 04-Messenger & Presence

    41/54

    Channel ObjectContains properties, methods, and events forsending and receiving data and for interacting with the chat historywindow.

    Error ObjectContains properties for presenting error information tothe user.

    FileInfo ObjectContains properties for determining the status of afile transfer.

    Messenger ObjectContains methods for launching client dialogpages.

    User ObjectContains properties for ascertaining user name, e-mailaddress, and Live ID Unique ID (UID) of conversants.

    Users Collection- The top-level collection ofUser objects.

    41

  • 8/14/2019 04-Messenger & Presence

    42/54

    When a Windows Live Messenger Activity is running, theWindows Live Messenger script engine is firing events to theapplication.

    In order for two instances of the application to communicatewith each other, appropriate event handlers must be defined.For example, if the SendData method is used to send a string

    from one instance to the other, an OnDataReceived eventhandler must be defined to receive the string.

    Some commonly used event handlers are: OnRemoteAppLoaded

    OnRemoteAppClosed

    OnDataReceived

    OnDataError

    OnTypeChanged OnAppClose

    Event Handling

  • 8/14/2019 04-Messenger & Presence

    43/54

    Multi-user activities can exchange data and synchronize between twoinstances

    The following processes make up the foundation of a multi-user WindowsLive Messenger Activity: Synchronizing

    The first application to load calls Channel.Initialize, and then waits for the eventChannel.OnRemoteAppLoaded to fire.

    The second application calls Channel.Initialize when it is ready to communicate, and the eventChannel.OnRemoteAppLoaded fires immediately.

    Sending and receiving data Similar to Single User Activities, the primary way to send information is by the method

    Channel.SendData. An application must have an event handler called Channel.OnDataReceived; thisevent fires when the application receives data.

    The method Channel.SendFile can be used to transfer files. If used, the application must also have anevent handler for Channel.OnFileReceived.

    Error handling Again similar to Single User Activities, An application should have an event handler for

    Channel.OnDataError. This event fires ifChannel.SendData fails. Typically, an application should try to send the data again, in case the error was an isolated

    communication problem.

    Multi-User Activities

  • 8/14/2019 04-Messenger & Presence

    44/54

    Activities run in a sandbox

    Basic features are unrestricted

    Advanced features Permission Flags ActiveXRequired to host ActiveX controls on the application Web page.

    EnableIPRequired to get the IP addresses for the computers running theapplication.

    PassportSiteIDRequired to perform Live ID authentication, or to get the username or e-mail address of a participant.

    ReceiveIMRequired to view the contents of incoming chat messages.

    ReplaceIMRequired to intercept and replace the contents of incoming chatmessages.

    SendFileRequired to send files as part of the application.

    SendIMRequired to send a chat message to the remote user, either as thelocal user or as the application.

    UserPropertiesRequired to perform Live ID authentication, or to get the

    44

  • 8/14/2019 04-Messenger & Presence

    45/54

    Several Activity features require special approval: Sending and receiving instant messages

    Sending files

    Hosting ActiveX controls

    Getting the client IP address

    Using Windows Live ID authentication

    To implement these features, you must request them bywriting to the Windows Live Support alias([email protected]).

    You must provide a detailed description explaining why

    special permissions are needed and how they will be used.In addition, the Windows Live Support team may ask youto supply code for your application that details how youwill implement the features.

  • 8/14/2019 04-Messenger & Presence

    46/54

    Build with ASP, VBScript, C, C++, C#, others

    Must not contain any functionality found in the Messengerclient.

    Instant messaging

    File transfer (for example, digital photos or sound files)

    Audio conversation capabilities

    Control of a Web camera or use of a video conferencing session

    Application sharing

    Creation of a white board space

    46

  • 8/14/2019 04-Messenger & Presence

    47/54

    Download the Activity SDK from MSDN at http://msdn.microsoft.com/live/msnmessenger/.

    Develop your Activity and perform pre-review compliancetesting of the application, as specified in the SDK.

    Submit your Activity for final review at http://gallery.live.com/ before it is enabled for use by Messengerusers.

    Activity is reviewed based on features and review

    requirements.

    Windows Live notifies you when the Activity is enabled for

  • 8/14/2019 04-Messenger & Presence

    48/54

    Functional spec Special permissions and features (nextslide)

    Test plan

    Demonstrate compliance withrequirements

    Test case documentation

    Test case details

    48

  • 8/14/2019 04-Messenger & Presence

    49/54

    Must have IE 5.01 or later installed

    Must include help

    ActiveX controls must be signed

    You must handle the case where thecontrol is not installed.

    Additional software requirements Notify user that 3rd party software is

    required

    Check if already installed

    49

  • 8/14/2019 04-Messenger & Presence

    50/54

    Copy MSGRP2P.xml

    Copy to 2 computers if multi user

    XML changes Tic Tac Toe

    http://server/app/defaulthtm

    50

  • 8/14/2019 04-Messenger & Presence

    51/54

    51

  • 8/14/2019 04-Messenger & Presence

    52/54

    Messenger Development on Windows Live Devhttp://dev.live.com/messenger

    Activity API SDKhttp://msdn2.microsoft.com/en-us/library/aa751024.aspx

    Get Started

  • 8/14/2019 04-Messenger & Presence

    53/54

  • 8/14/2019 04-Messenger & Presence

    54/54

    2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/orother countries.

    The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond tochanging market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date

    of this presentation.MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.