Jack Twain
Jack Twain

Reputation: 6372

The architecture of a real-time web chat app

I would to create a real-time web chat application using web.py in python. The problem is that I don't know how to 'architect' or design the such an app.

The way I'm thinking to implement this app is the following:

However I see this is a very poor design since I see a lot of ajax requests being sent here. I really don't know if there are better designs or architectures for such a service. So can you please point me toward the correct design for a real-time chat app?

Upvotes: 2

Views: 2752

Answers (1)

Devarsh Desai
Devarsh Desai

Reputation: 6112

Alex,

This is an understandable question, I recently thought about it when I was building my own messaging application. This is the way I broke down the app's functionality:

       User registration
       User authentication
       Adding a new friend by username
       Approving a friend
       Messaging with a friend in list (Of course)
       Shows online and offline users
       Runs a background service in order to get messages even when the application is closed.
       Uses notification area when a new message is received.
       Quiting the application(kills the background service)

A few things I realized after building this application was:

  1. The back-end architecture was a simple mixture of a simple CRUD application with pub/sub functionality. You can read up more on pub/sub systems here. Here's a simple chat application built using Ruby on Rails. You can look at it for reference, it's very well architected.
  2. You should think about the last steps listed in the above functionality as much in the beginning of this app as you do in the end. If you architect it well in the beginning, the final steps will just fall into place! :-)
  3. If you want to learn about concurrency and do something really cool, I suggest trying to implement some of the frameworks discussed here.

Please let me know if you have any questions!

Upvotes: 2

Related Questions