Skip to content

princepal-dev/socket

Repository files navigation

SocketDrop

SocketDrop is a lightweight real-time file sharing app built with Java and Spring Boot.
Users connect via WebSockets, join rooms, and share files with live progress updates — without authentication or a database.

Features

  • WebSocket-based real-time communication
  • Room-based file sharing
  • File upload, download, and delete via HTTP
  • Live transfer progress updates
  • QR-code based room join (URL)
  • In-memory storage only

HTTP API

  • POST /file/uploads (multipart file, optional roomId for progress broadcast)
  • GET /file/downloads/{fileId}
  • DELETE /file/downloads/{fileId}

WebSocket API (/room)

  • Client messages:
    • { "type": "CREATE_ROOM", "displayName": "alice" }
    • { "type": "JOIN_ROOM", "roomId": "room_x", "displayName": "bob" }
    • { "type": "LEAVE_ROOM" }
  • Server messages:
    • ROOM_CREATED
    • ROOM_JOINED
    • UPLOAD_PROGRESS (STARTED, COMPLETED, FAILED)
    • ERROR

Frontend

  • Static single-page UI is available at / via src/main/resources/static/index.html.
  • Assets:
    • src/main/resources/static/app.js
    • src/main/resources/static/styles.css
  • Supports create/join/leave room, room-scoped upload, room-authorized download, and delete.

Tech Stack

  • Java 17
  • Spring Boot
  • Spring WebSocket
  • Spring Web (REST)
  • Maven

Notes

  • No authentication
  • No database
  • Designed for learning and demonstration purposes

Containerized Run

Build and run with Docker

docker build -t socket-drop:latest .
docker run --rm -p 8080:8080 -v socket_drop_storage:/app/storage socket-drop:latest

Run with Docker Compose

docker compose up --build

Container environment variables

  • SPRING_FILE_BASE_PATH (default: /app/storage)
  • SPRING_FILE_MAX_SIZE (default in app: 524288000)
  • SPRING_FILE_MAX_DOWNLOAD_SIZE (default in app: 52428800)
  • SPRING_SERVLET_MULTIPART_MAX_FILE_SIZE (default: 50MB)
  • SPRING_SERVLET_MULTIPART_MAX_REQUEST_SIZE (default: 50MB)

Author

Prince Pal

Created by Prince Pal with love.

LinkedIn: https://www.linkedin.com/in/princepal-dev/

About

SocketDrop is a lightweight real-time file sharing app built with Java and Spring Boot.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors