Overview
ClipSync uses session-based synchronization to enable real-time clipboard sharing across multiple devices. Each session is identified by a unique 5-character alphanumeric code that devices use to join and sync clipboard content.How Sessions Work
Sessions are the core mechanism for connecting devices in ClipSync:- Each session has a unique 5-character code (e.g.,
A3B7K) - Multiple devices can join the same session using the code
- All devices in a session see real-time updates when content is added
- Sessions persist in the Supabase database until explicitly deleted
Creating a New Session
When you first send clipboard content without joining an existing session, ClipSync automatically creates a new session for you.Session Code Generation
The session code is generated using a random combination of uppercase letters (A-Z) and numbers (0-9):src/service/doc.service.js
Automatic Session Creation
From App.jsx:167-177, when you send content without an active session:src/App.jsx:167-177
Joining an Existing Session
To sync with devices already in a session, you need to enter the session code.Join Process
- Enter the 5-character session code in the input field
- Click the “Join” button
- ClipSync validates the code exists in the database
- If valid, your device joins and retrieves the clipboard history
Session codes are case-insensitive and automatically converted to uppercase for consistency.
Leaving a Session
You can leave a session at any time by clicking the logout icon next to the session code. From App.jsx:484-494:src/App.jsx:484-494
Session Persistence
ClipSync uses localStorage to remember your session across browser sessions:Auto-Reconnect on Page Load
From App.jsx:64-85:src/App.jsx:64-85
Storage Keys
localStorage.sessionCode: Stores the current session code for persistencesessionStorage.clipboard: Temporarily stores clipboard input (cleared on tab close)
If you return to ClipSync in the same browser, you’ll automatically rejoin your last session.
Session Sharing
To connect multiple devices:- Create or join a session on your first device
- Note the 5-character session code displayed at the top
- On other devices, enter this code and click “Join”
- All devices can now send and receive clipboard content in real-time