Skip to content

AdrikaJaiswal/Study-Session-Backend

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Study Session Backend

A FastAPI-based WebSocket server for managing real-time study sessions with JWT authentication.

Features

  • JWT token-based authentication
  • WebSocket connections for real-time messaging
  • Session management with host and member roles
  • Real-time event broadcasting (member-joined, member-left, session-ended, receive-message)

Installation

Install dependencies using pip:

pip install -r requirements.txt

Running the Server

Start the server with Uvicorn:

uvicorn main:app --reload

The server will be available at http://localhost:8000

API Endpoints

Create Session

  • Endpoint: POST /create-session
  • Parameters: token (query parameter)
  • Response: {"session_code": "abc123"}

WebSocket Connection

  • Endpoint: WS /ws/{session_code}
  • Parameters:
    • session_code (path parameter)
    • token (query parameter)
  • Events:
    • member-joined: When a user joins the session
    • receive-message: Real-time messages from members
    • member-left: When a member disconnects
    • session-ended: When the host disconnects

Configuration

  • SECRET_KEY: JWT secret key (update in production)
  • ALGORITHM: JWT algorithm (default: HS256)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 100.0%