Skip to content

dishankgoel/Mini-Classroom

Repository files navigation

Mini Classroom

This project was started as a part of our CS-433 Computer Networks course at IIT Gandhinagar, and was colaboratively made by Dishank Goel, Harshit Kumar and Pushkar Mujumdar


Mini Classroom


Problem Statement-

Design and implement Mini Classroom, a simple internet tool that mimics the functionalities of Google Classroom and some additional features. Build your application on top of TCP.


Directory Structure

πŸ“

Mini-Classroom
β”œβ”€β”€ api.py
β”œβ”€β”€ app.py
β”œβ”€β”€ chat_client.py
β”œβ”€β”€ chat_server.py
β”œβ”€β”€ database
β”‚Β Β  └── make_database.py
β”œβ”€β”€ http_lib.py
β”œβ”€β”€ mininet_tests.py
β”œβ”€β”€ models.py
β”œβ”€β”€ README.md
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ server.py
β”œβ”€β”€ server_to_app.py
β”œβ”€β”€ start_app.sh
β”œβ”€β”€ start_chat_app.sh
└── static
    β”œβ”€β”€ attendance.html
    β”œβ”€β”€ class.html
    β”œβ”€β”€ classrooms.html
    β”œβ”€β”€ create_class.html
    β”œβ”€β”€ css
    β”‚Β Β  β”œβ”€β”€ chat.css
    β”‚Β Β  β”œβ”€β”€ cover.css
    β”‚Β Β  β”œβ”€β”€ offcanvas.css
    β”‚Β Β  └── signin.css
    β”œβ”€β”€ discussion.html
    β”œβ”€β”€ error.html
    β”œβ”€β”€ group_discussions.html
    β”œβ”€β”€ img
    β”‚Β Β  β”œβ”€β”€ class_icon.png
    β”‚Β Β  └── login_icon.png
    β”œβ”€β”€ index.html
    β”œβ”€β”€ join_class.html
    β”œβ”€β”€ js
    β”‚Β Β  └── offconvas.js
    β”œβ”€β”€ live_class.html
    β”œβ”€β”€ login.html
    β”œβ”€β”€ posts_by_tag.html
    β”œβ”€β”€ signup.html
    └── students.html

Feature Checklist

βœ…

Basic Features -

βœ… Any Client is able to sign up and create an account with Mini Classroom
βœ… Client can Login and Logout 
βœ… Client can create a classroom and be the instructor of the class
βœ… Client can join a classroom as a student by using the classroom code
βœ… Only the Instructor can post updates to the classroom
βœ… Students (and the instructor) can view posts on the classroom

Advance Features -

βœ… Instructor can associate a Tag with each post
βœ… Students and the Instructor can view posts Categorized by Tags
βœ… Instructor can initiate a Live Classroom Session 
βœ… Students and Instructor can join and send messages in the Live Classroom Session
βœ… Instructor can initiate a Group Discussion on any topic
βœ… Students and Instructor can send public messages in the Group Discussion
βœ… Students can send private messages only to the Instructor
βœ… Instructor can send private messages to any student
βœ… Concurrent server which can handle several client requests
βœ… Multiple instances of server

Security Features πŸ”’-

βœ… Users need to Authenticate (Login) with the server before accessing any features
βœ… When a client enters a password, the input is masked
βœ… Only the Instructor can access all the students in a classroom

Bonus Features -

βœ… Attendance Management: Instructors can access Attendance of any Live Classroom session
βœ… Group Chat with Students
βœ… Browser based GUI for all features except Live Chat and Group Chat
βœ… Live Chat and Group Chat are command line based features

Use Cases

πŸ•ΉοΈ

A client in a particular Classroom can have one of the two roles -

  1. Instructor
    Instructor
  2. Student
    Student

Communication Paradigm for web application

πŸ›°οΈ

  • We have Implemented HTTP protocol on top of TCP
  • Request πŸ”ƒ Response paradigm.
  • Client establishes connection with the server.
  • Client sends request to the server as URL and request method.
  • HTTP parser parses the headers of the HTTP request and makes use of the following headers -
    1. First line: Method (GET/POST), URL, Protocol (HTTP/version)
    2. Content length: Length of the body of the request in bytes
    3. Content type: Type of content in the body.
    4. Set cookie: To give the client a token for authorization and usage for further communication
    5. Cookie: To store the authorization token
    6. Location: To redirect the client to a new route
  • HTTP library sends the following headers in the HTTP response -
    1. First line: Version, Response Code
    2. Server: Name of the server (Custom server in our case)
    3. Content type: Specifies the type of the content in the body.
    4. Content length: Length of the content in the body
    5. Connection: Used to specify if connection is persistent/non-persistent. In our case, Connection = close in the response as we are keeping it non-persistent.
  • Response Codes sent by server include:
    • 200 - OK (Request is OK, render HTML)
    • 302 - Moved Permanently (used for redirect)
    • 404 - Not Found (error response)
    • 405 - Method Not Acceptable (error response)

Communication paradigm for Live Classroom Feature

πŸ›°οΈ

  • Full duplex bidirectional communication.
  • The size of the JSON object is sent first, followed by the JSON object itself.
  • Whenever a client sends a message, the live-class server receives it and broadcasts it to all clients.

App Logic

🚲

Below is the High Level Design of the App App logic


Overview of Implementation

βš™οΈ

HTTP Library overview 🏒-

HTTP Library

Server-side overview πŸ’»-

Servers

Server to Application overview πŸ“²-

Server to App

Database and Data Structures overview πŸ—„οΈ -

Database


How To Use

πŸ› οΈ

  1. Make sure that all the dependencies are installed by running.
    $ pip3 install -r requirements.txt

  2. First, the database needs to be created. Make sure you have mysql installed and the sql server is up and running. Go into the database/ directory. Run:
    $ python3 make_database.py <IP of database> <user> <password>
    In case of running database server on localhost, the IP will be 127.0.0.1 and user and password as per configuration

  3. Deploy app server: This server is the main backend for the application. To deploy this, run
    $ ./start_app.sh <ip_of_server>
    Note: Edit ./start_app.sh for database configurations if the database is not on localhost.

  4. Deploy chat server: This server handles the live chatting and group chatting. It has a different network paradigm than app server. To deploy this, run
    $ ./start_chat_app.sh <ip_of_server>
    Note: Edit ./start_chat_app.sh for database configurations if the database is not on localhost.

  5. The application is now ready to use.


Deployment Strategy

🧠

Intended deployment strategy is a simple tree topology, with all the clients at leaf nodes, database server connected to switch s7 at depth-0, 2 app servers and 1 chat server connected to switches at depth-1.

Deployment


Screenshots

πŸ“·

Home Page

Home Page


Student view for joined Classrooms

Classrooms


Instructor view for Classroom

Classroom as Instructor


Group Discussion view for Classroom

GD as Instructor


About

A web development framework + Mini-Classroom app like Google Classroom all from scratch! Down to the socket level!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors