I am working on chat application based on django, but for real time notifications and chatting, I plan on using django channels. The problem is that apart from documentation there are hardly any resources available to get in-dept knowledge of the concepts.
Can anyone suggest a way to implement notifications in my application as when a user receives a message, he/she gets notified(using websockets concept).
Also, I plan on using channels as a way to display which of the users are currently online.
Models are as follows :
class Person(models.Model):
user = models.OneToOneField(User)
name = models.CharField(max_length=50)
contact = models.CharField(max_length=12)
online = models.IntegerField(default=0)
def __str__(self):
return self.name
class Dialog(models.Model):
author = models.ForeignKey(Person,related_name="self")
reader = models.ForeignKey(Person)
def __str__(self):
return self.author.name + " - " + self.reader.name
class Message(models.Model):
dialog = models.ForeignKey(Dialog)
sender = models.ForeignKey(Person)
text = models.TextField()
def __str__(self):
return self.sender.name + " : " + self.text
I have been stuck with this problem for a while now. I would be grateful if anyone can suggest a solution.
Thanks in advance.