This project demonstrates a distributed Fibonacci sequence calculation using WebSocket communication between a laptop and a mobile device. The demo showcases dynamic programming principles with real-time logging of all operations.
- Laptop: Acts as a computation node and web server
- Mobile Device: Acts as a storage node
- Communication: WebSocket (Socket.IO) for real-time device-to-device communication
- UI: Real-time logging of all Fibonacci DP operations
- Node.js (v14 or higher)
- npm (v6 or higher)
- A modern web browser (Chrome, Firefox, or Safari recommended)
- Both devices must be on the same network
- Clone the repository
- Install dependencies:
npm install
-
Start the server:
npm start
-
Access the web interface:
- On your laptop: http://localhost:3000
- On your mobile device: Use your laptop's local IP address (e.g., http://192.168.x.x:3000)
-
Select roles for each device:
- One device should select "Laptop" role (computation)
- One device should select "Phone" role (storage)
-
Enter n and click "Calculate F(n)" to begin the demo
To access the application from other devices on your local network:
-
Find your computer's local IP address:
- Windows: Run
ipconfigin Command Prompt - macOS/Linux: Run
ifconfigin Terminal - Look for the IPv4 address under your active network adapter
- Windows: Run
-
Ensure your computer's firewall allows incoming connections on port 3000
-
Access the application from other devices using:
http://<your-computer-ip>:3000
The application can be hosted on various cloud platforms:
-
Heroku
- Create a new Heroku app
- Connect your GitHub repository
- Deploy the application
- Note: Both devices must be on the same network for WebSocket communication
-
Vercel
- Import your repository
- Configure build settings
- Deploy the application
- Note: Both devices must be on the same network for WebSocket communication
-
AWS/GCP/Azure
- Deploy to a virtual machine
- Configure security groups to allow port 3000
- Set up a domain name if needed
- Note: Both devices must be on the same network for WebSocket communication
- WebSocket communication requires both devices to be on the same network
- For full functionality, local network deployment is recommended
- Ensure proper security measures when exposing the application to the internet
- Real-time logging of all Fibonacci DP operations
- Interactive UI with device panels
- Secure WebSocket communication
- Dynamic programming demonstration
- Role swapping between devices
- Automatic reconnection handling
- State persistence for storage device
- The application uses WebSocket for real-time communication
- All communications are logged for transparency
- State is persisted locally on the storage device
If you encounter connection issues:
- Ensure both devices are on the same network
- Check that the server is running and accessible
- Verify that port 3000 is not blocked by firewalls
- Try refreshing the browser on both devices
- Check the browser console for any error messages