2

I'm going to make AJAX instant messenger app for my Django project and I would like to know if I am thinking in right direction and if not - what am I missing.
So in my mind the problem is not so hard actually, rough plan is:

  1. Make MessageModel that has fields like:
    Sender, Receiver, MsgContent, Date
  2. Create a view + template for POSTing new message(creating new entry in the database)
  3. Monitor POST method of the sender. Or utilize GET somehow, technical details for this step is very vague in my mind, but the idea that we just use AJAX and that's it.
  4. Outputting messages

To make messenger multi-user(group talks) we can simply use some kind of list in Receiver field.

In theory it looks quite simple, but I feel like something is really wrong with my understanding of it. Do I need something more than MessageModel and AJAX? I don't have much experience with real-time application, just made simple AJAX search-engine through the site and that's basically it.

Any help, links, names of useful tools is highly appreciated.

ScienceSamovar
  • 422
  • 7
  • 15
  • If you use ajax then you have to constantly ping server for new messages and this idea is a resource bottelneck, instead go for web sockets supported by most web browser's now. – Vishnu Apr 02 '15 at 04:30
  • I know that russian social-media vk.com uses Ajax for messaging, and they have up to 70 million users daily, from what they say it is very robust, haven't heard someone had huge problems with it, and I don't expect thousands of users actually. And I heard that you can make Ajax requests through unix socket, i.e. no loading on ports. Actually I heard more bad things about stuff like socket.io than Ajax. – ScienceSamovar Apr 02 '15 at 04:35
  • Also read this if you wonder why Ajax and not websokets(I'm not against it, just don't wanna use it in this exact project) http://stackoverflow.com/questions/10377384/why-use-ajax-when-websockets-is-available – ScienceSamovar Apr 02 '15 at 04:45

1 Answers1

1

I would like to answer my own question because I already did the stuff I wanted.
So the answer is Yes - you can make simple instant-messenger using only Django and jquery+AJAX. At least simple polling one. I suspect long-polling can be done also using same things, though it would take more time obviously, maybe I will try to do it later and write about it.
So if anyone else wants to do something similar - give it a try, not so hard as it looks.

ScienceSamovar
  • 422
  • 7
  • 15