Since March 10, 2003 - Version 2.1
hypothetic.org

MSN Messenger Protocol

Notification - Example Session

Back To Normal Layout

Overview

This page illustrates what an entire notification session might look like. This page does not (yet) exhaustively show every command that can be sent to a notification server.

Conventions Used on This Page

Throughout this page, the protocol is displayed from the point of view of Alice's (alice@passport.com) client.

Example

Logging in - messenger.hotmail.com

The client (alice@passport.com) connects to messenger.hotmail.com on TCP port 1863. The client understands protocol version 8. It also supports CVR0.

>>> VER 1 MSNP8 CVR0\r\n

<<< VER 1 MSNP8 CVR0\r\n

Having successfully negotiated a protocol version, the client gives its protocol version information.

>>> CVR 2 0x0409 win 4.10 i386 MSNMSGR 5.0.0544 MSMSGS example@passport.com\r\n

<<< CVR 2 6.0.0602 6.0.0602 1.0.0000 http://download.microsoft.com/download/8/a/4/8a42bcae-f533-4468-b871-d2bc8dd32e9e/SETUP9x.EXE http://messenger.msn.com\r\n

Alice's client attempts to authenticate itself. However, the server redirects it to baym-cs118.msgr.hotmail.com (IP address 207.46.106.118), port 1863.

>>> USR 3 TWN I alice@passport.com\r\n

<<< XFR 3 NS 207.46.106.118:1863 0 207.46.104.20:1863\r\n

Logging in - baym-cs118.msgr.hotmail.com

The client (alice@passport.com) connects to baym-cs118.msgr.hotmail.com on TCP port 1863. The client understands protocol version 8, and supports CVR0.

>>> VER 4 MSNP8 CVR0\r\n

<<< VER 4 MSNP8 CVR0\r\n

The client gives its protocol version information again.

>>> CVR 5 0x0409 win 4.10 i386 MSNMSGR 5.0.0544 MSMSGS example@passport.com\r\n

<<< CVR 5 6.0.0602 6.0.0602 1.0.0000 http://download.microsoft.com/download/8/a/4/8a42bcae-f533-4468-b871-d2bc8dd32e9e/SETUP9x.EXE http://messenger.msn.com\r\n

Alice's client attempts to authenticate itself, and the server returns a long string for use in Passport authentication.

>>> USR 6 TWN I alice@passport.com\r\n

<<< USR 6 TWN S lc=1033,id=507,tw=40,fs=1,ru=http%3A%2F%2Fmessenger%2Emsn%2Ecom,ct=1062764229,kpp=1,kv=5,ver=2.1.0173.1,tpf=43f8a4c8ed940c04e3740be46c4d1619\r\n

Alice authenticates with MS Passport (see the authentication example page), then replies with her ticket.

>>> USR 7 TWN S t=53*1hAu8ADuD3TEwdXoOMi08sD*2!cMrntTwVMTjoB3p6stWTqzbkKZPVQzA5NOt19SLI60PY!b8K4YhC!Ooo5ug$$&p=5eKBBC!yBH6ex5mftp!a9DrSb0B3hU8aqAWpaPn07iCGBw5akemiWSd7t2ot!okPvIR!Wqk!MKvi1IMpxfhkao9wpxlMWYAZ!DqRfACmyQGG112Bp9xrk04!BVBUa9*H9mJLoWw39m63YQRE1yHnYNv08nyz43D3OnMcaCoeSaEHVM7LpR*LWDme29qq2X3j8N\r\n

<<< USR 7 OK alice@passport.com Alice 1 0\r\n

Alice has now successfully logged into the notification server. Her client might remember to log straight into baym-cs118.msgr.hotmail.com next time it connects to MSN Messenger, instead of going through messenger.hotmail.com. The server takes this opportunity to send Alice's profile details.

<<< MSG Hotmail Hotmail 491\r\n
    MIME-Version: 1.0\r\n
    Content-Type: text/x-msmsgsprofile; charset=UTF-8\r\n
    LoginTime: 1050223062\r\n
    EmailEnabled: 0\r\n
    MemberIdHigh: 85040\r\n
    MemberIdLow: -517030579\r\n
    lang_preference: 1033\r\n
    preferredEmail: alice@passport.com\r\n
    country: US\r\n
    PostalCode: 90201\r\n
    Gender: m\r\n
    Kid: 0\r\n
    Age: \r\n
    BDayPre: 5\r\n
    Birthday: 0\r\n
    Wallet: 0\r\n
    Flags: 1027\r\n
    sid: 507\r\n
    kv: 4\r\n
    MSPAuth: MSPAuth: 41bbzZ*NzDmDQ8ic4HWo89b9zhCBk!​ONDJKB3Los8UMgBnCOLSwQKo!8IeIH​QF0vVItSlOzIL36e5MAdMaB3mpZw$$\r\n
    ClientIP: 1.2.3.4\r\n
    ClientPort: 516.\r\n
    \r\n

Synchronising

Alice's client now synchronises her local copy of her contact lists with the copy held on the server. Last time Alice's client logged on, the list was at version number 6 but the list has now jumped to version number 27.

>>> SYN 8 6\r\n

<<< SYN 8 27 5 4\r\n

Because the list versions don't match, the server sends all of Alice's of contact information (not just what's changed between versions 6 and 27). At first, the server sends one message in every packet of data.

<<< GTC A\r\n
<<< BLP AL\r\n

<<< PRP PHH 01%20234\r\n
<<< PRP PHM 56%20789\r\n

Then, the server sends the entire group list in a single packet. Since Alice's client is written in a programming language that handles incoming data one packet at a time, it has to separate these lines out and handle them one at a time.

<<< LSG 0 Other%20Contacts 0\r\n
    LSG 1 Coworkers 0\r\n
    LSG 2 Friends 0\r\n
    LSG 3 Family 0\r\n

Then the server sends Alice's contact list. The first person in her contact list is Bob, whose nickname is "Bob". He's on her forward, block, and reverse lists. He hasn't chosen to share any phone numbers, but does have an MSN mobile device we can use. His details are all sent in a single packet, which we have to separate out and handle individually.

<<< LST bob@passport.com Bob 13 0\r\n
    BPR MOB Y\r\n

The second person in Alice's list is Carol, whose nickname is "Carol". She has shared her work phone number (9876-54321), but no other information. Unfortunately, the server sends Carol's details in two packets, split in the middle of a command. Alice's client will have to reconstruct the lines of data before handling them.

<<< LST carol@passport.com Carol 3 0\r\n
    BPR PHM 9876

<<< -54321\r\n

Then, the server sends details for Dave. Dave is just on Alice's forward list. He's in her "Coworkers", "Friends", and "Family" groups. He's set his home phone number to "3.1415926535", his work phone number to "2.71841844", and his mobile number to "sqrt(-1)". The server has cut his details into several packets.

<<< LST dave@passport.com 1 1,2

<<< ,3\r\n
    BPR PHH 3.1415926535\r\n
    BPR PH

<<< W

<<<

<<< 2.71841844\r\n
    BPR PHM sqrt(-1)\r\n

Next, the server sends information about Eve (the evil eavesdropper), who has been blocked from seeing Alice's presence.

<<< LST eve@passport.com Eavesdropper 12\r\n

Finally, the server sends details about Fred, who must have been recently added, as he is on Alice's reverse list but not her add or block list.

<<< LST fred@passport.com Fred 8\r\n

Here is a summary of who will receive whose presence:

Initial presence

Now Alice has synchronised her contact lists, she sends her initial presence, and at the same time allows Fred to see her presence information. The presence command causes the server to send presence information for Alice's contacts that are currently online. Notice how the ADD reply comes in the middle of the ILNs, making it harder to elegantly handle them.

>>> CHG 9 NLN 0\r\n
>>> ADD 10 AL fred@passport.com Fred\r\n

<<< CHG 9 NLN 0\r\n
    ILN 9 NLN bob@passport.com Bob 24\r\n
    ILN 9 IDL carol@passport.com Carol 268435492\r\n

<<< ADD 10 AL 28 fred@passport.com Fred 1\r\n
    ILN 9 BSY emily@passport.com Emily 268435492\r\n

Challenge

The server challenges Alice's client with the string "29409134351025259292".

<<< CHL 0 29409134351025259292\r\n

Alice's client adds "Q1P7W2E4J9R8U3S5" to the end of this string, to produce "29409134351025259292Q1P7W2E4J9R8U3S5". The MD5 digest of that string is "d0c1178c689350104350d99f8c36ed9c".

>>> QRY 11 msmsgs@msnmsgr.com 32\r\n
    d0c1178c689350104350d99f8c36ed9c (no newline)

The server accepts Alice's response to this challenge.

<<< QRY 11

More presence changes

Alice walks away from her computer. After a few minutes, Alice's client sets her online state to "idle".

>>> CHG 12 IDL 0\r\n

<<< CHG 12 IDL 0\r\n

While Alice is away, Bob goes offline.

<<< FLN bob@passport.com\r\n

When Alices returns, her client sets her online state to "online".

>>> CHG 13 NLN 0\r\n

<<< CHG 13 NLN 0\r\n

Shortly afterwards, Carol changes her online state to "Busy", and changes her display name.

<<< NLN BSY carol@passport.com Caroline 268435492\r\n

Nickname changes

Because Carol changed her display name with her last change of online state, Alice's client updates Carol's nickname to match.

>>> REA 14 carol@passport.com Caroline\r\n

<<< REA 14 28 carol@passport.com Caroline\r\n

Alice decides that she doesn't want Bob to see here presence information any longer, so her client removes him from her allow list, and adds him to her block list.

>>> REM 15 AL bob@passport.com\r\n
    ADD 16 BL bob@passport.com Bob\r\n

Log out

Finally, Alice decides to log out of MSN Messenger.

OUT\r\n

<o> Server closes connection

Copyright ©2002-2004 to Mike Mintz.
<http://www.mikemintz.com/>