Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

P2P Whiteboard Platform

A terminal-based peer-to-peer whiteboard collaboration platform built with OCaml, featuring real-time synchronization.

Overview

This project creates a collaborative whiteboard that allows multiple users to connect over a network and draw together in real-time. The application runs entirely in the terminal using text-based graphics.

Prerequisites

Before running the application, ensure you have the following installed:

  • OCaml (version 4.13 or later)
  • OPAM (OCaml package manager)
  • Dune (build system)

Required OCaml Packages

The following packages are automatically installed when you build the project:

  • notty - Terminal graphics library
  • nottui - Terminal UI framework
  • lwd - Lightweight widgets
  • luv - Async I/O library
  • yojson - JSON handling
  • lwt - Asynchronous programming
  • cohttp-lwt-unix - HTTP client/server
  • uri - URI handling
  • cmdliner - Command-line parsing
  • sqlite3 - Database support

Installation & Setup

  1. Clone or navigate to the project directory:

    cd /path/to/peerboard
  2. Install dependencies:

    opam install --deps-only .
    eval $(opam env)
  3. Build the project:

    dune build

Running the Application

Basic Usage

Run the application with default settings:

_build/default/bin/main.exe

This starts the whiteboard with:

  • Port: 8080
  • Canvas size: 80x30 characters
  • Multicast group: 239.0.0.1

Command Line Options

View all available options:

_build/default/bin/main.exe --help

Available Options:

  • -p PORT, --port=PORT (default: 8080)
    Network port for P2P communication

  • -w WIDTH, --width=WIDTH (default: 80)
    Canvas width in characters

  • --height=HEIGHT (default: 30)
    Canvas height in characters

  • --bridge-mode
    Enable bridge mode for external communication

  • -c FILE, --config=FILE
    Specify a configuration file path

Example Commands:

# Custom port and canvas size
_build/default/bin/main.exe --port 9000 --width 100 --height 40

# Large canvas for detailed drawings
_build/default/bin/main.exe --width 120 --height 50

# Different network port
_build/default/bin/main.exe --port 8081

Usage Instructions

Controls

Once the application is running, you can use these controls:

Navigation:

  • Arrow Keys - Move cursor around the canvas
  • Tab/Shift+Tab - Switch between panels (Canvas/Chat/Menu)

Drawing:

  • Space/Enter - Draw with current tool at cursor position
  • 1-5 - Select drawing tools:
    • 1: Pen
    • 2: Line
    • 3: Rectangle
    • 4: Circle
    • 5: Text

Colors:

  • F1-F8 - Select colors:
    • F1: Black
    • F2: Red
    • F3: Green
    • F4: Yellow
    • F5: Blue
    • F6: Magenta
    • F7: Cyan
    • F8: White

General:

  • h - Toggle help display
  • Ctrl+L - Clear canvas
  • Ctrl+Q - Quit application

Chat Commands:

  • /help - Show help information

Network Features

The application automatically:

  • Broadcasts your presence to other peers on the network
  • Synchronizes drawing actions in real-time
  • Maintains a list of connected peers
  • Uses multicast for peer discovery

Troubleshooting

Common Issues:

  1. "Nested calls to Lwt_main.run are not allowed"

    • This is a known issue that has been addressed in the latest version
    • The application should still start and function properly
  2. Network connectivity issues:

    • Ensure the port (default 8080) is not blocked by firewall
    • Check that multicast is enabled on your network
    • Try using a different port with --port
  3. Build errors:

    • Make sure all dependencies are installed: opam install --deps-only .
    • Update your environment: eval $(opam env)
    • Clean and rebuild: dune clean && dune build
  4. Terminal display issues:

    • Ensure your terminal supports UTF-8 encoding
    • Use a terminal with good Unicode support for best results

Getting Help:

  • Press h in the application to see built-in help
  • Use --help flag to see command-line options
  • Check the terminal output for status messages

Development

Project Structure:

peerboard/
├── bin/           # Main executable
├── lib/           # Core library modules
├── lib/ui_module/ # User interface components
├── docs/          # Documentation
└── _build/        # Build artifacts (ignored in git)

Building for Development:

# Clean build
dune clean

# Build with verbose output
dune build --verbose

# Build and run tests
dune runtest

Notes

  • LLM/Ollama integration has been disabled in this version for simplicity
  • Storage features are currently simplified
  • The application is designed for terminal use - no graphical interface needed
  • Supports multiple simultaneous users on the same network

Version

Current version: 0.1.0

For more information or issues, check the project documentation or source code.