Skip to content

Overview

This is a project provide it by Dezzex Technology Pvt Ltd to build real-time messaging app

Getting Started

$ git clone https://github.com/Mohamed-Kaizen/dezzex_technology_pvt_ltd_real_time_messaging_challenge

---> 100%

Install dependence:

You need to install python and poetry first

$ poetry install && poetry shell

---> 100%

Run the server:

1. Create .env file:

create .env in the root of the project or set your ENV add the following line into .env file or set your ENV:

DEBUG=True  # change this in production
ALLOWED_HOSTS=example.com, localhost, 0.0.0.0, 127.0.0.1  # change this in production
SECRET_KEY=w86k@*ash*z)dsxsoz+o*ne*ugb08(4nu13%8!m*+2_e@@7hnx  # change this in production and never put the production key here
DATABASE_URL=sqlite:///db.sqlite3  # Choose whatever sql database you want
EMAIL_USER=example@example.com
EMAIL_PASSWORD=''

2. Run migrations:

$ python manage.py makemigrations

---> 100%


$ python manage.py migrate

---> 100%

3. Load fixtures:

$ python manage.py loaddata users.json  chat.json

---> 100%

4. Run the server:

$ python manage.py runserver

Django version 4.2.2,
Starting ASGI/Daphne version 4.0.0 development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

Go the Admin Page and login with the following credentials:

username: mohamed
password: 1234567899mnm

Go to Open API UI to see the API documentation

5. Using the API

5.1. Create user:

Image title

5.2. Login:

Image title Image title

5.3. Create Message:

Image title

5.4. Get Messages:

Only the user who sent the message or the user who received the message can get the message of the room

Image title

6. Websocket

In this example we will use Hoppscotch

6.1. Connect to websocket:

Image title

6.2. Send your token:

Image title

6.3. Send your message via Admin page Admin Page:

Image title

6.4. You will receive the message:

Image title

7. Run the tests:

$ python manage.py runserver

================= 9 passed in 0.69s ===============

License: MIT


Last update: 2023-06-09
Authors: Mohamed-Kaizen (93.45%), Not Committed Yet (6.55%)