I continue to hammer at the chat program when I have time, trying to mold it in to something a little more useful. Not really useful in the sense that I expect anyone else would use it - it is still primarily a learning exercise. However, I do have the desire to work on some simple web games and I figure with a little more work on the chat I could put it to good use there.
So, what is new? This update of the chat reworks the foundation a little bit, making all the messages passed back and forth between the server and client JSON based. Once a connection is established both ends of the connection we go ahead and register various event handlers to deal with the messages being passed back and forth. Using this reworked machinery I introduce a new feature to the chat - namely that you can now see a list of users also currently in the chat. For now everyone who joins the chat will show up as some sort of anonymous. In the future I am going to work on hooking in some sort of authentication system.
On the server side, at the very base all we do now is keep track of who is connected and send out messages to the clients based on that information (e.g. Joined/Dropped messages). The actual chat functionality is handled by one of the aforementioned event handlers. Similarly, on the client side we have an object responsible for handling the user list information and an object responsible for handling the chat messages. There isn't really much more to it than that at the moment.
You can download all the updated code files here.