Sunday, July 15, 2007

TinyBuddy IM: Instant Messaging for iPhone (v1)

(This is a repost from my other blog, but putting the content here for completeness)

Have an iPhone, but wish you could IM your buddies? Now you can, with TinyBuddy IM. It is an AIM® Enabled web-based IM tool. It works by using the Web AIM API, OpenAuth and Dojo.

The nice thing about this solution: you do not send your AIM password to me -- you are redirected to AOL's OpenAuth servers for authentication. My JavaScript only sees an auth token. Furthermore, my web page has to get your explicit consent before accessing your buddy list data and before sending the first IM or presence change.

So the price of this added security is pop-up windows. A new window will be popped so you can authenticate with the OpenAuth servers, and also when giving consent to the application to access your buddy list and IM. For the consent prompts, you can choose "Grant Always" to avoid them on subsequent logins. I think the pop-ups are worth the added security, and at least in iPhone's Safari, window popping looks neat. Unfortunately, the OpenAuth Sign In and Consent pages are made for larger windows, so you will have to double-tap zoom to read them.

Another neat feature of this web application: it is pure JavaScript, HTML and CSS. No server-side languages needed. Dojo really made it easy to do this. I used Dojo 0.4.3 because I want to reuse this code for some other projects that are on 0.4.3, but if/when I get enough time, I would like to port it over to the 0.9 code.

So give it a whirl if you like. I'm sure the code it not bulletproof, and I've noticed enough weirdness with iPhone's Safari to guarantee that I will not be able to give comprehensive support. Also, even though I'm an AOL employee, AOL does not endorse this project or have anything to do with it (but thanks to my co-workers for ideas and early testing, all done of their own accord).

Also, I'm using an OpenAuth dev key, so if there is too much usage you might see some rate limit errors, but we'll see how it goes.

Some other interesting tidbits:

  • The Web AIM API is a Comet API. It uses long polling to work cross-domain in the browser. I'm using more of a short poll with pauses between the polls to hopefully smooth out network hiccups on the phone.
  • Don't like the CSS? You can make your own and tell the app to use it instead. Go to the test launcher page to specify the path to your CSS. Click the Launch button, then copy launch URL. Use that URL when you want to use the application. This feature is not allowed for IE browsers given its security problems with CSS "expressions".
  • I'm serving the code gzipped. The HTML, CSS and JavaScript combined come to about 90 KB. So it is tolerable on the EDGE network.
  • Use the iPhone two finger scroll to scroll the buddy list and IM conversations.
  • Typing IMs should be optimally sized for use with the virtual keyboard. Just type in the text box at the bottom of the IM window and press "Go" on the keyboard.
  • I'm using Dojo Accordions for the IMs and buddy list. I like the use of space with that model and that I can show you incoming IM text if that IM AccordionPane is in the closed position.
  • onbeforeunload does not seem to fire for iPhone Safari. That makes it hard to log out correctly, so to clear your OpenAuth cookies, be sure to use the Available, Sign Out menu item.
To use TinyBuddy IM, just type http://tybyim.com in the iPhone Safari browser. You can try it in other browsers, but it looks best in the iPhone Safari.


18 comments:

Anonymous said...

Way to go, tinybuddy!

I don't have an iPhone, but I thought I'd see if it would work on a Treo650 with Blazer v4.0 browser on the Sprint network.  It fails every time saying the page is too large -- probably because of the Dojo dependencies, indicating the page is 322.3K.  The memory limit per page is configurable -- currently 1MB per page. Also, there's 344K available for the cache and 1K for cookies.  When I access the site via FF, Charles and Firebug/Net both show that all components should be under the limit.  JS and cookies are permitted, so I'm not sure what led to this error msg -- seems due to something other than download size.

I don't expect a response...just sharing.

Anonymous said...

I tried on my Treo 650, and Blazer doesn't understand the JS/CSS it seems.  I tried with Opera Mini 3.1 and it has the same problem--and can't log into SNS--I get a 400 Bad Request response when attempting SNS login.

Anonymous said...

dossynj: Yes, the Blazer is not powerful enough to run it, similar with the Opera Mini. However, I think there is a good chance the Opera on the Wii would work. At least, it worked with an earlier version, but I have not tried recently. It also might work on the Minimo browser -- I think I heard someone was able to put that on one of their Nokia phones, but not sure.

Anonymous said...

tried on my daughters iPHONE.  Something strange happened, and now she can't log into AIM from a computer or the iPHONE.  Her .mac account worked, her aim account blew up.  Would love to un freeze the aim account as the AOL email address attached to it has LONG ago been abandon.

Anonymous said...

mabarron: You can try going to http://screenname.aol.com and there is a "Forgot Password" link. You can try that path to see if that will fix your account, if you are unsure about the password. You can also try signing in on that page if you know the password, and if there is some sort of freeze on the account, hopefully there will be instructions on what you can do to change it.

Anonymous said...

can you add a options button with settings to add friends and minus.....also in the options put in so that we can pick how long we want it to take bfore it logs us out... I like to go from myspace to aim and it logs me off to fast its annoying.

Anonymous said...

bluetoxin8: I'll look at adding the ability to add and remove buddies from the buddy list. I was trying to keep the feature set small (just a quick way to send an IM to a friend without using SMS). Do you find you need to add/remove buddies a lot while using it?

As for the sign-off time: when you switch to another browser window or to another iPhone/iPod Touch application, the device automatically suspends javascript on the TinyBuddy IM page. This causes you to get logged out after 30 seconds. I cannot do too much about fixing that (just a limitation of the device environment, and the AIM server enforces the 30 second timeout). But I appreciate it makes the page less useful. I'm hoping things will improve once Apple releases a real developer SDK in February.

Anonymous said...

hey have you thought of creating a web apps for MSN messenger it would be greatly appresciated. Msn messenger is one of the top instant messenger networks

Anonymous said...

It worked when I first used it, now says kids accounts can't use this why?

Anonymous said...

vep93: I am not restricting any accounts -- it might be enforced by the OpenAuth sign in page. Or maybe there were parental controls applied to the account that limited IM use? I'm not sure, but from my side, I'm not doing any explicit blocking.

Anonymous said...

kandeekay87: I don't use MSN messenger, but I can understand how that might be useful. I'm not sure if they have an API that I could use. If someone wanted to build something that works with MSN messenger, they can grab the source code for TinyBuddy IM (http://x.aim.com/ty_source/) and swap out the AIM API wrapper with an MSN wrapper. But I do not have plans to do it.

Anonymous said...

why does the IM sign off if you leave it for more than 30 seconds? and is there a way you could change it so it doesn't shut off, it just stays on until you manually sign off??

 

Anonymous said...

I love the idea of having AIM on my iPhone..but I have problem with it signing off after 30 secs.. Is there a way you can sign in and stating signed in until you want to sign off. Have you thought about adding a sound which let's you know you have a new instant message. I love what you've done..but alittle updating wouldn't hurt.

Anonymous said...

topmodelisme: I cannot do much about the 30 second timeout if you switch browser windows or applications. That is a restriction enforced by the Mobile Safari browser. I would also like to add sound, but there is no sound API exposed for me to do so. I have filed an enhancement request with Apple, but I am not sure if anything will come of it.

I just did a release today (v3.50) that should improve the sign-on experience. It should be easier to do now, and require less input of your name and password.

Anonymous said...

I like how u fix aim but can u please update the aim that won't automatically sign off by itself. Its better if u can manually sign off ur aim rather than signing off by itself every other 30 seconds....

Anonymous said...

if I was going to give constant user attention to an app, i'd use my computer instead. A much better idea is to queue messages on the server and have them delivered when the user returns to the server again. Aim on sprint or yahoo IM on general yahoo mobile wap, does this, and prevents lost messages. I do aaplaud the effort of this hard working developer thought !

Anonymous said...

First of all thank you for creating this software I am constantly on the go and this comes in handy. I was wondering if when everyone gets signed off if you could create a remember me button so u don't have to put ur screen name and password

Anonymous said...

socmitch14: After you sign in the first time, if you get signed off, and you go back to Sign In again, that sign in screen should show you still signed on, and there is a "Do not ask me again" checkbox you can check on the screen for it to remember you better.

That all should work as long as you do not clear cookies in Safari. If you do that, you may be asked to sign in again.

There are some new capabilities in the latest Safari that may make it easier for me to remember you. I have it on my list to look at, but my time for it is very limited. I am also not sure how useful it is to maintain this web application when people can download a native AIM client from the App Store.