Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I was able to use facebook chat with an external application using the following information:

First, find your Facebook username by going to http://www.facebook.com/your_user/. Next, Open iChat, then select iChat » Preferences and click on the Accounts tab.

Click on the + (plus) sign to add a new account, with these settings:

* Account Type is Jabber Account
* Account name is your_user@chat.facebook.com, and enter

your password * Click the drop-down arrow to reveal Server options. Enter chat.facebook.com as the server name. * Enter 5222 as the port and click Done.

Click Done again, and you are good to go.

From reading this, it seems that it might be possible to telnet into facebook chat. I tried, but wasn't able to. Is it possible? How?

share|improve this question

3 Answers 3

up vote 6 down vote accepted

There is no practical way to do this using a telnet client, as you would have to type all of the XML yourself, which is incredibly impractical. There are however several command-line XMPP clients available, as discussed in this stack overflow question.

List of Jabber Console Clients

If you are interested in learning about the XMPP protocol, I suggest you install Pidgin and take a look at the XMPP console by right-clicking on the Pidgin notification icon and choosing XMPP Console from the menu. All of the XMPP messages sent to and from your client will be shown, including every typing notification, status update, etc. It's very interesting to look at, and you can even try your hand at sending custom XMPP status codes from the console.

xmpp console pidgin

share|improve this answer
    
Can someone please edit out the "123456" stuff? I had to add it in to get around a weird design flaw in this web site that required I change 6 more characters before accepting a correction I made to the format of the list of Jabber solutions. Thanks. –  Randolf Richardson Mar 8 '11 at 6:28
1  
@Randolf: The "design flaw" you are referring to is an intentional limit to prevent one-character edits. –  grawity Mar 8 '11 at 12:43

From (very) limited testing, it seems possible.


Run telnet chat.facebook.com 5222 to connect, then proceed sending valid XML conforming to the Jabber protocol specification.

$ telnet chat.facebook.com 5222
Trying 69.63.181.105...
Connected to chat.facebook.com.
Escape character is '^]'.
<?xml version="1.0">
<stream>
// here I was looking up auth
Connection closed by foreign host.

Be aware that the server closes your connection within about a minute of inactivity, so looking up the protocol ad-hoc isn't practical. Or anything related to raw Jabber, as typing XML flawlessly isn't that easy, and once you send malformed XML, the connection closes immediately.

$ telnet chat.facebook.com 5222
Trying 69.63.181.105...
Connected to chat.facebook.com.
Escape character is '^]'.
<stream>
<?xml version="1.0"?><stream:stream id="5D13A2D5" from="chat.facebook.com" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" xml:lang="en"><stream:error><invalid-namespace xmlns="urn:ietf:params:xml:ns:xmpp-streams"/></stream:error></stream:stream>Connection closed by foreign host

If you want to suffer while chatting, a command-line client might be a better option. Alternatively, create a minimal client yourself, if it's about the protocol, so you don't have to type the XML under pressure -- and you don't suffer from the Telnet differences.

share|improve this answer
    
How can I find out what the correct XML to send is? –  tony_sid Mar 8 '11 at 6:20
2  
@OSXJedi By reading and understanding the Jabber protocol specification I linked to. Jabber is XML and even less intended for direct human use than FTP or IRC. You could also try to use another Jabber client and log your network traffic. That should give you an idea what to do based on a real example. –  Daniel Beck Mar 8 '11 at 6:21
    
Actually I am trying to create a client for facebook chat. That's why I started tinkering around with telnet, so that I could understand how to communicate with the chat server. –  tony_sid Mar 8 '11 at 6:28
2  
@OSXJedi Then the best thing to do is probably to log your network traffic when using another Jabber client, as well as reading the specs. You likely don't have the time and typing accuracy to do this well enough using telnet. You can always add a "raw XML" feature to your client software for debugging purposes that lets you (the user) type in the XML directly, and build additional user features on top of that, so that e.g. auth happens automatically. But telnet isn't the way to go. –  Daniel Beck Mar 8 '11 at 6:31
    
How would I log the network traffic? Would Wireshark be good for this? –  tony_sid Mar 8 '11 at 6:33

Using telnet probably won't work as well as you'd like it to -- you probably mean a "raw socket connection." If you know the Jabber protocol really really well, you can do it with PuTTY:

  • putty -raw chat.facebook.com 5222

The best thing to do is to just get a Jabber client and connect to the hostname chat.facebook.com with it.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.