Yes, I know there are a lot of Ajaxchatapplications out there, some moreadvanced than others. Which is precisely why I'm writing my own. It's a well defined application which should let me worry about learning the techniques and not about developing ground breaking new features. Chat is not quite the Hello World of Ajax, but it's one of the simplest yet useful things I could do. I didn't learn very much by writing an Ajax Hello World example and it's completely pointless
Being a good software engineer, before I make a start on this Chat App here are some requirements to get me started and keep me focused. Maybe this will distract you from the fact that there's no code here - apart from that wonderful Hello World:
- All messages sent by other users while a user is in the chat room should be displayed to the user.
- Notification of new users entering the chat should be shown to all users.
- Notification of users leaving the chat should be shown to all users.
- A chat message consists of the actual text of the message, the name of the person who sent it and the time it was sent.
A mini functional spec
- All text is UTF-8
- Max length of user name is 20 characters
- Max length of message text is 256 characters.
- The user should not have to use the mouse to work the app - make good use of access keys and auto-focus.
- Focus should start in the message entry box once the app has loaded.
- Pressing ENTER should send the text in the message entry box
- Once a message has been sent, the message entry box should be cleared and given focus, ready for the user to type a new message.
- User is given a default name on first joining the chat.
- The default name should be unique, but simple to read.
- User can change their name by editing a form field
- Display of messages should not cause the page to become too big. Do not show more than 50 messages to the user. New messages that cause this limit to be exceeded should cause the oldest message to be removed so that the new message can be displayed.
- Display of messages should not cause the page to become too "physically big". Scroll the message history neatly.
- User should always be able to see the last message received, unless they are deliberately reviewing older messages. (i.e. Auto-scroll to make new messages visible)
- Only the main page should be explicitly loaded by the user - all servers communication is done in Ajax!
- All server communication errors should be communicated to the user in a friendly way so that any problems are obvious and diagnosable
- Bandwidth usage should be kept to a minimum. I don't want to have to upgrade my hosting account to run this.
Wow this post seems to have gone on a bit. Sorry. Here's a fun Ajax enabled post-it note board to wake you up.