Chat Application Architecture
Chat Application Architecture
1
INDEX
Contents
INDEX ......................................................................................................................................................................... 2
1. OBJECTIVE ......................................................................................................................................................... 2
2. REQUIREMENT SPECIFICATIONS ........................................................................................................................ 2
2.1 ACTORS AND USE CASE ........................................................................................................................................... 2
2.1.1 UC01- User login ....................................................................................................................................... 2
2.1.2 UC02 – Ask or Post queries ....................................................................................................................... 3
2.1.3 UC03 – Save contents ............................................................................................................................... 3
2.1.4 UC04 – Authentication Services ................................................................................................................ 3
2.1.5 UC05 – Logout .......................................................................................................................................... 3
3. CONCEPTUAL MODEL: ....................................................................................................................................... 3
4. ARCHITECTURE DIAGRAM ................................................................................................................................. 5
5. QUALITY ATTRIBUTES & LIST OF ARCHITECTURALLY SIGNIFICANT REQUIREMENTS........................................... 6
6. ARCHITECTURE PATTERNS ................................................................................................................................. 7
7. FAILURE AND IMPROVEMENTS.......................................................................................................................... 7
7.1 FAILURES ..................................................................................................................................................................... 7
7.2 IMPROVEMENTS ............................................................................................................................................................ 7
1. Objective
To build a chat application architecture that supports interaction among students and between
teachers & students.
2. Requirement Specifications
There is a requirement in an educational institution to establish a communication system between
students and subject teachers. The communication application is required to be a chat application
that will enable students to discuss, post queries and teachers can respond to queries as well post
questions/quizzes/assignments or it’s related information. This application can be used on either
computers or mobile devices like tab or mobile phones and should be available always when
needed. The application is supposed to work 24x7 during institutional working days without fail.
2
2.1.2 UC02 – Ask or Post queries
Actors: Users (Teachers, Students)
Use Case: Chat application should be able to get/post queries received by users. Techers
should be able to resolve queries of students. Students should be able to communicate
with other users.
3. Conceptual Model:
The basic architecture is composed by a Back-end with Python and Django, using PostgreSQL
database and ReactJS and Redux on the Front-end. The simple chat system is without real-time
3
operations, in other words, just a CRUD of messages with simple database modeling with only two
tables: Chat and Message. The below diagram is for simple chat application architecture.
The above simple architecture of chat application is client and server architecture without real-time
implementation. The simple chat app does not provide auto refresh of the chat responses. Therefore
for better user experience there is need to introduce the real-time refresh of the chats. The
synchronization of chat application will make better user experience. The below diagram shows
modified chat application with auto refresh feature:
4
4. Architecture Diagram
Chat Server Engine is a core of the chat architecture that handles message delivery and dispatch.
In our version of chat architecture, it includes the following components:
Chat REST API handles the tasks that are not connected directly to message dispatch and
delivery, such as user authentication, changing of user settings, friends’ invitation,
downloading sticker packs, etc. The Chat App (the chat client part) communicates with the
Chat REST API via the Chat REST API Client Library.
Chat WebSocket Server is responsible for transmitting messages between users. The Chat
App communicates with the Chat WebSocket Server via the Chat WebSocket Client
Library. This connection is open two ways; that means users don’t have to make requests
to the server if there are any messages for them, they just get them right away.
Chat Media Storage Server is a pool of servers responsible for storing user media files.
The files are uploaded to them via the Chat Media Storage Client Library.
Chat App is the other major part of the chat architecture, the one that users directly interact with.
It's split into three separate root components:
Chat Client Engine handles all of the communication with the Chat Server Engine via its
internal components: Chat REST API Client Library, Chat WebSocket Client Library and
Chat Media Storage Client Library. It also comprises the Chat Push Message Handler that
deals with push notifications.
Chat UI displays data to users via its widgets: Chat Contact List UI, Chat Dialog
UI, Chat Push Message Widget—extension for mobile apps that allow for replying to
messages without opening the app and Chat Internal Notification Widget—a widget that
pops up at the top of the screen while the user is chatting in a dialog and notifies about the
incoming message in another dialog.
5
Chat Device Storage is an internal database (read: your device storage), which stores
messages and files so that users can access them offline. Its internal component, Chat
Media Cache, gets media files from the Chat Media Storage and stores them on the device
so that the user can access them anytime without having to reach the Chat Media Storage
every time.
Quality Refinement
Architecturally Significant Requirements
Attribute Attribute
1. Chat system should be able to deliver and provide messages in
1. Transaction real-time without delay not permitted more than 0.3 sec. (H, M)
response time 2. The system should be able to support multiple simultaneous user
Performance 2. Throughput connections (150) at peak load. (H,H)
1. A functionality upgrade into UI completes without introduction
of delays/lags. (M,M)
1. Normal 2. Users can request help or access help documents and system
operations provides helps within 5 second. (M,L)
2. Proficiency End users should be able to understand the application use within 1
Usability training day. (M,L)
1. The institution introduces new features for users and
1. User-defined configuration team should be able to introduce within a working
Configurability changes day. (M,L)
1. A maintainer encounters search- and response-time deficiencies,
fixes the bug, and distributes the bug fix with no more than 3
1. Routine changes person-days of effort. (H,M)
2. Upgrades to 2. The database (Chat content media/storage server) vendor
commercial releases a new version that must be installed in less than 3 person-
Maintainability components weeks. (H,M)
1. Adding new 1. Adding a quiz module that provides details of quiz and result to
Extensibility product individuals, requires 2 persons a month time. (M,M)
1. Users should only be able to see their chats but NOT for other
users’ session. (H,H)
1. Confidentiality 2. The system resists unauthorized intrusion and reports the
Security 2. Integrity intrusion attempt to authorities within 90 seconds.(H,H)
6
6. Architecture Patterns
There are below mentioned Architecture patterns used for the chat application:
1. Client-Server pattern – The idea to have this pattern is to support Separation of concerns,
Synchronous Communication and Flexible Deployment.
7.2 Improvements
The above failures can be addressed by following:
1. Scalability: Each architecture component is a potential bottleneck when a project grows
bigger and begins to serve a larger audience. The advantage of independent components is
that they can be scaled separately without affecting the entire architecture. To achieve this
we will introduce scalability within the architecture by introducing load balanced cluster of
servers or application servers. This will reduce the overhead performance on single server.
3. Customization and migration: All the architecture components can easily be adjusted
to the institution’s needs. For example, they can be powered by different services: the Chat
WebSocket Server can be built on PubNub, Twilio, or Firebase, while Chat Media Storage
can be powered by Cloudinary or Amazon S3. Or will build any of the components entirely
from scratch if it is needed to perform specific tasks.