How are messaging apps like Whatsapp or Messenger built? - django

I'm trying to build a mobile messaging app like Whatsapp and don't know where to start. In the first place, I don't know how messaging apps send messages between users. What type of protocol do they use? Do they use websockets? Do they use some sort of long polling? I mean what I really want to know is how the server works and is there a name to this sort of communication?
FYI, I was looking to try and build a messaging app with a Django (something like django channels) server and React native for the mobile app.
Thanks for reading.

Yes to create a chat application like messenger or WhatsApp you will need to use websocket, also a cache like redis
If you want to create a chat backend with django and django channels you can follow this repository, this is pretty basic. You can use this repo to build a chat api, which you can use with a mobile app/desktop app as well as a web app
https://github.com/khan-asfi-reza/ChatAPI
This is a minimalistic Chat Api built with django, django rest framework, django channels.
And if you want something more extra like read/seen feature, this following repo will be best
https://github.com/Bearle/django_private_chat2
And for react native app, you can see the following repo, this codebase might be a bit complex for beginners
https://github.com/cometchat-pro/react-native-chat-app.git

Related

Can we move Amazon Honeycode Apps to Android Play store?

Am Exploring Amazon Honeycode Beta version for web/Mobile app development. Am able to develop an app in Amazon Honeycode Portal. Am trying to understand that is there any possibility to move the honeycode app to Android Play store or Amazon restrict only to Team members who has installed Honeycode app ?
You can invite users to the app however are you asking for an Android Native app?
It depends how easy it is to jump out of the walled garden. If your app is a fully fledged website then you're good to go directly to the app and use a thin wrapper like electron. However based on the documentation you're app is making api calls, the HoneyCode app is doing the heavy lifting for the frontend.
To build your own you would need a frontend to make the same api calls and render it.
The api only has two apis. Probably check if you can get the data you want working first before building the frontend.
Something like amplify handles the frontend better.

How create application backend in django and create a api so that other developers can use that as well

I just started learning Django and wanted to make an application with API (probably REST) endpoints so that other developers can use it as well (like GitHub API), and I could connect it to my react app and android app. I want my backend to be on a different server and do not want to build my react app integrated with Django backend using the REST Framework.
Can anyone just give me the general idea of what I need to do?
P.S. Sorry in advance if my question sounds silly, I am still new to backend.
Creating a Django REST API should be your first step. This is pretty simple if you already have a Django app running, and will allow your React app or Android app to connect and access data.
Authentication is a step beyond. You may want to look into implementing authentication on the server you will be hosting your back end on. You can also read through this article for some guidance on implementing auth on the DRF side.
Best of luck!
First off all you can start from this.
https://www.django-rest-framework.org/tutorial/quickstart/

Send notifications through DRF

Hello I'm building a RESTfull application using Django Rest Framework.
The clients are android application and react application.
I need to send a time based notification to users.
To send push notifications you can use the well supported https://github.com/jazzband/django-push-notifications app
It is not necessary to use FCM for android. I personally like to use Firebase Cloud Messaging (FCM). If you want to give it a try i suggest to use the pyfcm library https://pypi.org/project/pyfcm/
.
It's pretty straight forward and well documented. As for the authentication problems in the django-rest-framework, please be more specific.

how do I make django and tornado communicate with each other

I have a social networking kinda an app in Django and I wanna integrate real-time notifications and messaging functionality in my app.
my friends could build a tornado app but I wanna basically connect them together (my guess are I have to make a REST API correct me if I'm wrong)
how can I do these kinda tasks from Django
Authenticate automatically to a WebSocket(tornado) as I logged in my
django app
import all of my friends
send tornado signal to send notifications if the user didn't receive a message
things like that
how do I do stuff like that.
(BTW I don't wanna use django channels as it's fairly new)
You can use a message broker library like ZeroMQ or RabbitMQ to help them communicate with each other (The Django instance and the Tornado websockets component).
They provide several message architectures like server-client or publisher-subscriber.

Can Django be used to combine both webapp and moblie api?

I want to use django framework to write a web site with static/dynamic pages (I will not be using angular/react - i.e. SPA technology) but I also want the web app to serve as the backend for a mobile app.
What's the best practice here? Can Django alone be used for it?
Will I need to use Django REST framework?
If you could recommend some specific modules to keep the app as simple as possible and avoid DRY code. That'd be great.
Thanks.
You have the right pointers in your question already.
Use django-rest-framework to create a rest service, create your web app in django to consume that service, create a mobile app to consume the same rest service.
In general, once you have a rest service, you can build anything on top of it. Just consume the service from whichever platform you want to build for.
I hope that helps.