6

I am working on a web project, and I have to make a web chat. My structure is more or less like this: you have a username, password, nickname and email, and you can chat with other people who are in your roster. I am using django (python) for the web back-end, and xmpp for the chat part.

I have read a lot about xmpp, and I implemented a simple chat using stanzas, with adding and removal of contacts, nicknames, etc.

What I want to ask is how to communicate with django and ejabberd, for things like registering a user (I don't want in-band registration, I only want to enable registration when the user creates an account), changing passwords, updating nicknames, etc. Mostly things that need some kind of elevated privilege to do.

I did some research before posting here, I am aware of sleekxmp, but as far as I am concerned, it is just a python library for xmpp. Also, I didn't found an API for ejabberd.

Thank you.

Pacha
  • 1,438
  • 3
  • 23
  • 46

2 Answers2

0

Read up on and using something like Workers to circumvent that. You don't want to naïvely use a sleek xmpp client in a view.

Since chat is full duplex, you probably want WebSocket + Django python WebService or Django / Comet (Push): Least of all evils? or even "oldskool" Long polling in Django

Community
  • 1
  • 1
Chris Wesseling
  • 6,226
  • 2
  • 36
  • 72
  • Unless explicitly told to be blocking, SleekXMPP runs connection(s) in separate threads. That is, if one don't want to setup a full-fledged Celery workers, having a process-global SleekXMPP connection (or connection pool) and using those from views for commands that can either run asynchronously or don't cause significant delays - like user registration or MUC administration - is acceptable in my opinion. Those XMPP connections quite resemble DB connections in such case. – drdaeman Dec 23 '14 at 17:25
0

By default, ejabberd uses internal users database, but you can setup ejabberd to manage users with external auth script - there are example scripts for integrating with Django app, with existing database, you can also write your own extauth script from scratch

vitalyster
  • 4,980
  • 3
  • 19
  • 27