Is There Any Python Module For Sending Messages Between Users In A Web Application?
Solution 1:
You're probably best off using an existing protocol like XMPP. For Plone (a Python CMS) for example there's a complete XMPP integration with collective.xmpp.chat providing multi-user chat and Instant Messaging between authenticated users of a Plone site (demo video).
For Pyramid you'll need to do this integration yourself [1]
, by running a Jabber / XMPP server (such as ejabberd) and using an existing XMPP client library for Python to communicate with it. There are plenty of XMPP libraries for Python, some of them are described in the answers to this question.
Note: Don't be scared if after looking at XMPP it looks way to complex. XMPP and its extension describe a wide variety of features related to Messaging and Presence, chat is just one of them. If you don't need the other features, simply don't implement them in your webapp.
[1]
Actually, there is a Pyramid project that seems to do exactly that: seshat, written by @KirkStrauser. I haven't used it myself, but it looks very promising.
Solution 2:
No; direct communication between two individuals isn't possible in web applications because they use stateless protocols; the server does not know if the request is coming from the same person or not. That being said, what chat applications usually do is store the communications within a database between the 2 individuals, and use AJAX to retrieve them. There are already lots of chat application tutorials and 3rd party chat application packages online; you might want to check them out.
Post a Comment for "Is There Any Python Module For Sending Messages Between Users In A Web Application?"