Commit Graph

146 Commits

Author SHA1 Message Date
b89e16bc0d Remove dead code: App-old.jsx and unused components
Cleanup:
- Delete App-old.jsx (1,368 lines) - outdated pre-refactor version
- Delete entire src/components/ directory (10 unused files)
  - QRScanner.jsx, QRCodeDisplay.jsx, Message.jsx
  - MethodSelector.jsx, FileUploadProgress.jsx, ChatView.jsx
  - ActionSelector.jsx, Header.jsx, TopicsList.jsx, ConnectionForm.jsx

Impact: Removes ~1,500 lines of dead code
Verified: No imports found, build passes
2025-12-12 22:50:29 +01:00
10673c7b62 Update NODE_HOST_GUIDE to use automatic API
- Replace manual WebRTC setup with offerFactory pattern
- Use publishService() + startFilling() instead of manual polling
- Update browser client to use connectToService()
- Remove all manual ICE candidate polling code
- Simplify shutdown to just call stopFilling()
- Reduce example from ~400 lines to ~150 lines
2025-12-12 22:44:04 +01:00
7af4362b53 Remove RondevuSignaler usage and simplify test-connect.js
- Use connectToService() for automatic connection setup
- Remove manual WebRTC setup (~120 lines reduced to ~60 lines)
- Much simpler and cleaner code

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-12 22:33:41 +01:00
056c027083 Update test-connect.js to use Rondevu.connect() and ICE presets
- Replace new Rondevu() + initialize() with Rondevu.connect()
- Use 'ipv4-turn' ICE server preset
- Use rondevu.addOfferIceCandidates() directly (no getAPIPublic())

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-12 22:21:58 +01:00
08bee1a6f7 Fix missing fqn variable in handleHostService
- Extract serviceFqn from publishResult for ICE candidate operations
- Fixes "ReferenceError: fqn is not defined" error

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-12 22:19:50 +01:00
9b5b35ef7d Update to use Rondevu.connect() and ICE server presets
- Replace new Rondevu() + initialize() with Rondevu.connect()
- Use rtcPreset state variable for iceServers option
- Update NODE_HOST_GUIDE.md examples to use presets and new API

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-12 22:13:13 +01:00
b9c07aeb5a Update for simplified client API and add Node.js hosting guide
Changes:
- Update App.jsx to use Rondevu.connect() instead of new + initialize()
- Update publishService to use 'service' parameter instead of 'serviceFqn'
- Remove explicit claimUsername() calls (now implicit)
- Add comprehensive NODE_HOST_GUIDE.md for hosting WebRTC services in Node.js
- Update README with Node.js hosting section

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-12 21:57:11 +01:00
7747f59060 Fix: Use ondatachannel instead of createDataChannel for answerer
CRITICAL BUG FIX: As the answerer, we should NOT create our own data channel.
The host (offerer) creates the channel, and we receive it via ondatachannel event.

This was causing messages to be sent on a different channel than the one
the host was listening to, so no messages were being received.

Changes:
- Remove pc.createDataChannel() call
- Add pc.ondatachannel event handler
- Wrap data channel setup in setupDataChannel() function
- Called when channel is received from host
2025-12-12 21:35:34 +01:00
d7caa81042 Add data channel state monitoring and increase send delay
- Increase delay to 500ms before sending identify
- Monitor channel state before sending
- Log bufferedAmount after send
- Add onclose handler for debugging
2025-12-12 21:32:08 +01:00
ac4826e92f Add delay and more debugging to identify message sending 2025-12-12 21:28:21 +01:00
1e46cef35f Add extensive debugging to message handler 2025-12-12 21:27:24 +01:00
9e0728f74a Implement demo message protocol in test script
- Send 'identify' message on connection
- Wait for 'identify_ack' acknowledgment
- Send 'message' type with text for chat
- Keep connection open 5s to receive responses
2025-12-12 21:26:01 +01:00
778fa2e3a9 Fix: Manually serialize ICE candidates for wrtc compatibility
wrtc library doesn't have toJSON() method on RTCIceCandidate.
Manually extract candidate properties instead.
2025-12-12 21:23:40 +01:00
8bb951a91c Fix: Set up ICE handlers before setLocalDescription
- Move onicecandidate handler setup before setLocalDescription
- Directly use API for sending candidates instead of signaler
- Use signaler only for receiving remote candidates
2025-12-12 21:22:39 +01:00
833bf7e519 Fix: Use same TURN config as demo (IPv4-based)
Update test script to use 57.129.61.67 instead of turn.share.fish
to match the demo's default 'ipv4-turn' preset.
2025-12-12 21:16:35 +01:00
508f050f6e Fix: Correct wrtc import for ES modules
The wrtc package needs to access default export when using dynamic import.
2025-12-12 21:13:51 +01:00
cf13672d85 Update test script to use same API URL and service version as demo
- Use api.ronde.vu instead of rondevu.xtrdev.workers.dev
- Use chat:2.0.0 instead of chat:1.0.0 to match demo
2025-12-12 21:10:50 +01:00
37eabff69c Update client package to latest version with batching and auto-claim 2025-12-12 21:06:36 +01:00
758fb2d4ec Improve test script error handling for missing wrtc
Better error message when wrtc is not installed, with clear
instructions on how to install it.

🤖 Generated with Claude Code
https://claude.com/claude-code

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-12 20:42:08 +01:00
4d95ddcd59 Move wrtc to optionalDependencies
wrtc requires native compilation and may fail on some systems.
Make it optional so the demo can build without it. Users who want
to run the Node.js test script can install it separately.

🤖 Generated with Claude Code
https://claude.com/claude-code

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-12 20:39:43 +01:00
023be0ab67 Add Node.js test script for connecting to @bas
Adds test-connect.js script that:
- Connects to production Rondevu API
- Discovers chat service from @bas
- Establishes WebRTC connection using wrtc
- Sends 'hello' message via data channel

Usage: npm test

Requires:
- Node.js 19+ (or 18 with --experimental-global-webcrypto)
- wrtc package for WebRTC in Node.js

🤖 Generated with Claude Code
https://claude.com/claude-code

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-12 20:34:41 +01:00
8959dd6616 Update client dependency for implicit username claiming
🤖 Generated with Claude Code
https://claude.com/claude-code

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-12 20:22:37 +01:00
5345ebb72f refactor: Update to use poll() instead of pollOffers() 2025-12-12 19:13:23 +01:00
d6b441e352 fix: Show claim UI instead of loading screen for new users
Changed loading condition from checking rondevu existence to checking setupStep.
New users now see the claim UI immediately instead of being stuck on Loading.
2025-12-12 12:29:35 +01:00
5789fc636b fix: Create Rondevu instance in handleClaimUsername for new users
The previous change broke the claim flow for new users because handleClaimUsername
expected rondevu to exist, but we stopped creating it during initialization for
new users. Now handleClaimUsername creates the Rondevu instance itself.
2025-12-12 12:05:45 +01:00
830f411291 feat: Prefill random username without auto-claiming
- Added generateRandomUsername() function
- Prefill username input with random suggestion
- Only create Rondevu instance for returning users with saved credentials
- Changed placeholder to "Choose a username"
- Users must explicitly click "Claim Username" button

This prevents automatic username claiming that was polluting the database
with anonymous users on every page load.
2025-12-12 12:02:06 +01:00
0640afc32c Revert "feat: Add connection pool status display"
This reverts commit a0c5ae18b4.
2025-12-10 22:42:00 +01:00
a0c5ae18b4 feat: Add connection pool status display
- Show real-time status of each host connection in the pool
- Status indicators: Waiting (gray), Answer received (orange), Connecting (blue), Connected (green)
- Visual feedback shows when offerer is waiting for answerer acceptance
- Connection pool counter shows active/total connections
- Helps users understand the connection lifecycle
2025-12-10 22:40:34 +01:00
00c1c21e6c feat: Unified chat UX - auto-accept connections on both sides
- Remove pending requests approval flow
- Auto-accept and open chat immediately when someone connects (same UX as initiating)
- Remove accept/decline buttons and pending requests UI
- Simplified flow: connection -> chat opens automatically
- Both offerer and answerer now have consistent UX
2025-12-10 22:34:20 +01:00
cd93226ea1 Update demo for unified Ed25519 authentication
- Remove all credential storage from localStorage
- Remove 'register' setup step (now: init → claim → ready)
- Update initialization to work without credentials
- Simplify localStorage to only username and keypair
- Anonymous users auto-claim during initialize()
- Named users manually claim username

localStorage keys:
- Keep: rondevu-username, rondevu-keypair, rondevu-contacts
- Remove: rondevu-chat-credentials

Setup flow:
- Load username/keypair from localStorage
- Create Rondevu instance (auto-generates anon username if none saved)
- Call initialize() (no register call)
- Check if username claimed
- Show claim UI if needed, or proceed to ready
2025-12-10 22:07:26 +01:00
2d7a88ba5f Fix close button styling and add disconnect for incoming chats
Close Button Improvements:
- Change pause icon (⏸) to close icon (✕) for clarity
- Change orange background to red (#dc3545) to indicate destructive action
- Update tooltip from 'Close chat' to 'End chat'
- Now visually distinct from the trash icon for removing friends

Add Disconnect for Incoming Chats:
- Add ✕ disconnect button to 'Active Chats' section (non-friends)
- Allows host to disconnect from incoming connections
- Same red styling as friend chat close button
- Shows 'Disconnected from {username}' toast

Both buttons now clearly indicate their purpose and work consistently
across friends and incoming chats.
2025-12-10 20:43:19 +01:00
55e197a5c5 Add connection request approval flow and improve friends list UX
Connection Request Approval:
- Add 'Connection Requests' section showing pending incoming connections
- Host must explicitly accept or deny incoming connection requests
- Shows username before accepting (no auto-accept)
- Accept: moves to active chats and sends acknowledgment
- Decline: closes connection and removes from pending
- Toast notification when someone wants to chat

Friends List UX Improvements:
- Add ⏸ (pause) button to close active chat without removing friend
- Change ✕ to 🗑 (trash) icon for removing friends
- Add confirmation dialog before removing a friend
- Separate 'close chat' from 'remove friend' actions
- Clearer visual distinction between actions

This prevents accidental friend removal and gives hosts control over
who they connect with before establishing the chat.
2025-12-10 20:36:27 +01:00
a08dd1dccc Add incoming chats UI and stop ICE polling when connected
UI improvements:
- Add 'Incoming Chats' section showing connections from non-friends
- Auto-select and show incoming chat when someone connects
- Toast notification when someone connects to you as host

ICE polling fix:
- Stop ICE candidate polling once connection is established
- Prevents unnecessary network requests after connection succeeds
- Only poll while in 'connecting' state

This fixes:
1. Host couldn't see incoming chats (they weren't in UI)
2. Answerer kept polling ICE candidates even after connected
2025-12-10 20:25:38 +01:00
249d1366d3 Fix ICE candidate timing issue: Buffer candidates before offerId is available
CRITICAL FIX: ICE gathering starts immediately when setLocalDescription() is
called, but we didn't have offerIds yet to send them to the server. This meant
all ICE candidates were lost before we could send them.

Solution:
- Attach temporary ICE handler BEFORE setLocalDescription()
- Buffer all ICE candidates in array until we have offerId
- After publishing and receiving offerIds, send all buffered candidates
- Replace handler with permanent one for any future candidates

This fixes the root cause of answerers not receiving any offerer candidates.
2025-12-10 20:17:02 +01:00
91b845aa1c Add detailed logging for answerer ICE candidate exchange
- Log when answerer starts polling for offerer ICE candidates
- Log count of candidates received from offerer
- Log each candidate being added with details
- Log success/failure of adding each candidate
- Log when answerer sends their own ICE candidates to server
- Helps debug ICE candidate exchange on answerer side
2025-12-10 20:06:11 +01:00
db651d4193 Filter ICE candidates by role in offerer polling
- Offerer now filters for answerer ICE candidates only
- Ignores own candidates returned from server
- Uses role field to distinguish between offerer and answerer candidates
- Improves logging to show answerer candidate count
2025-12-10 19:51:54 +01:00
a6329c8708 Implement combined polling and ICE candidate exchange for host
- Add offerId to RTCPeerConnection mapping for answer processing
- Setup ICE candidate handlers on offerer peer connections
- Replace answer-only polling with combined pollOffers() endpoint
- Process both answers and ICE candidates in single poll operation
- Track last poll timestamp to avoid reprocessing old data
- Send offerer ICE candidates to server via addOfferIceCandidates()
- Reduces HTTP requests and completes bidirectional ICE exchange
2025-12-10 19:33:31 +01:00
538315c51f Implement answer polling for offerer side
Host now polls for answered offers every 2 seconds using the new
efficient batch endpoint. When an answer is received, the host
automatically sets the remote description to complete the WebRTC
connection.

Changes:
- Store offerId to RTCPeerConnection mapping when publishing
- Poll for answered offers with timestamp filtering
- Automatically handle incoming answers
- Track last answer timestamp to avoid reprocessing

This completes the bidirectional WebRTC signaling flow.
2025-12-10 19:20:34 +01:00
6a24514e7b Fix signature validation issues in demo
- Add comprehensive logging for init and publish flows
- Verify username is claimed before publishing service
- Detect keypair mismatches and provide clear error messages
- Handle authentication errors more gracefully
- Auto-claim username if not claimed during publish
- Improved user guidance for common errors
2025-12-09 22:54:31 +01:00
46f0eb2e7a Restore full-featured chat UI with contact management, multiple chats, and RTC presets
- Restored contact management (add/remove friends)
- Restored multiple concurrent chat support
- Restored RTC configuration presets (ipv4-turn, hostname-turns, google-stun, relay-only, custom)
- Restored settings modal
- Restored dark theme styling
- Restored online status indicators
- Adapted all features to work with new unified Rondevu API
- Manual RTCPeerConnection management instead of ServiceHost/ServiceClient
- Manual offer pooling (10 concurrent connections)
- Manual ICE candidate polling
2025-12-09 22:49:11 +01:00
9e26ed3b66 Update to use local client package for development
- Install client from local path instead of npm registry
- Workaround for npm registry propagation delay

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-09 22:40:41 +01:00
7835ebd35d v2.1.0: Rewrite to use simplified Rondevu API
- Complete rewrite to use low-level Rondevu API directly
- Removed ServiceHost/ServiceClient abstractions
- Manual RTCPeerConnection and data channel setup
- Custom polling for answers and ICE candidates
- Updated to use new Rondevu class instead of RondevuService
- Direct signaling method calls instead of getAPI()
- Reduced from 926 lines to 542 lines (42% reduction)
- Demonstrates complete WebRTC flow with clear offerer/answerer roles

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-09 22:23:04 +01:00
5f223356ba feat: improve login persistence with server verification
- Properly await isUsernameClaimed() check during initialization
- Verify saved username is still valid on the server
- Show 'Welcome back' toast when restoring session
- Handle expired usernames gracefully
2025-12-08 21:39:58 +01:00
ab55a96fac fix: add missing ServiceHost and ServiceClient imports
- Import ServiceHost and ServiceClient from @xtr-dev/rondevu-client
- Fixes ReferenceError when starting hosting
2025-12-08 21:37:03 +01:00
158e001055 chore: update rondevu-client to v0.12.0 2025-12-07 22:23:13 +01:00
9967e8d762 Refactor demo to use new ServiceHost and ServiceClient API
- Update to @xtr-dev/rondevu-client v0.10.1
- Replace Rondevu class with RondevuService, ServiceHost, ServiceClient
- Simplify demo implementation (removed complex features)
- Use new event-driven API for connections
- Support custom RTC configuration
- Backup old implementation as App-old.jsx

Breaking changes from v1 API:
- RondevuService for username claiming
- ServiceHost for hosting services with offer pool
- ServiceClient for connecting with auto-reconnection

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-07 19:46:07 +01:00
8c3f21f262 Update @xtr-dev/rondevu-client to v0.10.0
- ServiceHost: Manages offer pool for hosting services
- ServiceClient: Connects to hosted services with auto-reconnection
- RondevuService: High-level API for username claiming and service publishing

Note: Demo code still uses old Rondevu API and needs refactoring

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-07 19:39:54 +01:00
c511b15fbf Update to rondevu-client v0.9.2 with ICE collection fix
Updated to @xtr-dev/rondevu-client@0.9.2 which fixes critical timing
issue where ICE candidates were generated before handlers were attached.

Now includes detailed logging for service pool ICE candidate generation
with candidate types (host/srflx/relay) for debugging TURN issues.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-07 11:33:42 +01:00
71454e31d1 Add WebRTC configuration settings UI
Added a settings modal with dropdown to select from preset RTC
configurations or provide custom JSON config:

- IPv4 TURN (Recommended): Uses explicit IPv4 addresses to avoid
  DNS resolution issues and address type mismatches
- Hostname TURNS (TLS): Uses secure TURNS on port 5349 with hostname
- Google STUN Only: Minimal config for testing direct connections
- Force TURN Relay: Testing mode that forces relay usage
- Custom Configuration: Users can paste their own RTCConfiguration JSON

Settings are persisted in localStorage and applied to all new
connections and service exposures.

This allows users to test different configurations without rebuilding
and helps diagnose connection issues.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-07 11:26:44 +01:00
b2a17ce42b Update to rondevu-client v0.9.1 with ICE logging
Updated to @xtr-dev/rondevu-client@0.9.1 which includes detailed
ICE candidate exchange logging for debugging connection issues.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-07 11:15:07 +01:00