Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Real-Time WebSocket Chat Backend

Spring Boot backend for a real-time chat application using STOMP over WebSocket, JWT auth, and MySQL.

Configure

  • Set environment variables (required):
    • DB_URL (optional, defaults to local chat_app)
    • DB_USERNAME
    • DB_PASSWORD
    • JWT_SECRET (32+ characters)
    • JWT_EXP_MINUTES (optional, default 60)
  • Optional local file: copy src/main/resources/application.example.yml to src/main/resources/application-local.yml and run with SPRING_PROFILES_ACTIVE=local.

PowerShell example:

$env:DB_URL="jdbc:mysql://localhost:3306/chat_app?useSSL=false&serverTimezone=UTC"
$env:DB_USERNAME="chat_user"
$env:DB_PASSWORD="change-me"
$env:JWT_SECRET="change-me-change-me-change-me-change"
$env:JWT_EXP_MINUTES="60"

Run

  • mvn spring-boot:run

REST API

  • POST /api/auth/register
  • POST /api/auth/login
  • GET /api/messages/public?limit=50
  • GET /api/messages/private/{username}?limit=50

WebSocket

  • Endpoint: /ws
  • Public send: /app/public.send
  • Public subscribe: /topic/public
  • Private send: /app/private.send
  • Private subscribe: /user/queue/private

Clients should pass Authorization: Bearer <JWT> in the STOMP CONNECT headers.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages