Protocols/MSNP/MSNP8/Example Session
MSNP Protocol |
Version 8 |
General |
Overview • Glossary |
Payload Commands • Names |
Bitwise AND |
Connecting |
Authentication • Presence |
Challenges • Getting Details |
Setting Details • Messages |
Miscellaneous |
Example Session |
Messaging |
Authentication • Miscellaneous |
Messages • Example Session |
Overview |
Introduction • Terms • Clients |
Reference |
Error List • Commands • Relying Party Suite • Spotlife |
Services |
XMPP • HTTP Gateway • Tabs • Activities |
Documentation |
Development Tools • MSNP Grid |
Polygamy • URLs used by MSN |
Documents |
Protocol Versions |
Version 21 |
Version 18 |
Version 16 |
Version 15 |
Version 14 |
Version 13 |
Version 12 |
Version 11 |
Version 9 |
Version 8 |
Version 2 |
MSNC |
Introduction • P2P • Object Descriptor • Display Pictures • File Transfer |
Scenarios |
Microsoft Messenger for Mac |
MSNP on WebTV (MSNTV) |
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. Copied from the msnp8 example session.
Conventions Used on This Page
Throughout this page, the protocol is displayed from the point of view of Alice's (alice@hotmail.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.107.95), port 1863.
>>> USR 3 TWN I alice@passport.com\r\n
<<< XFR 3 NS 207.46.107.95:1863 0 207.46.104.20:1863\r\n
Logging in - baym-cs118.msgr.hotmail.com
The client (alice@passport.com) connects to baym-cs295.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 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, and the server returns a long string for use in Passport authentication.
>>> USR 6 TWN I alice@hotmail.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 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-cs295.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: 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 an older version.
>>> 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 the versions). 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 a MSN Space. 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:
- Alice wants to receive presence information from Bob, Carol, and Dave. However, she doesn't know whether they have allowed or blocked her.
- Bob wants to receive Alice's presence information, and she has allowed him to.
- Carol is allowed to receive Alice's presence information, but doesn't want to.
- Dave wants to receive Alice's presence information, but is not allowed to.
- Eve wants to receive Alice's presence information, but is not allowed to.
- Fred wants to receive Alice's presence information, and is allowed to. He is neither in Alice's allow nor block list, but because Alice's BLP is set to AL, he is treated as if he was in Alice's allow list. Alice's client should ask Alice to add him to one or other list immediately.
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
Check this page for more information on challenge.
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