peerpigeon 1.0.3 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/README.md +60 -1
  2. package/dist/peerpigeon-browser.js +439 -6
  3. package/dist/peerpigeon-browser.js.map +3 -3
  4. package/docs/BINARY_IMPLEMENTATION_SUMMARY.md +304 -0
  5. package/docs/BINARY_MESSAGES.md +332 -0
  6. package/docs/STREAMING_API.md +542 -0
  7. package/docs/STREAMING_IMPLEMENTATION_SUMMARY.md +286 -0
  8. package/examples/binary-message-demo.html +496 -0
  9. package/examples/browser-2/EXPRESS_SOLUTION.md +183 -0
  10. package/examples/browser-2/ICE_DEBUG.md +171 -0
  11. package/examples/browser-2/IMPLEMENTATION.md +218 -0
  12. package/examples/browser-2/QUICK_START.md +149 -0
  13. package/examples/browser-2/README.md +303 -0
  14. package/examples/browser-2/dist/assets/index-Cck_6WJV.css +1 -0
  15. package/examples/browser-2/dist/assets/index-D8-cNlWQ.js +57 -0
  16. package/examples/browser-2/dist/index.html +32 -0
  17. package/examples/browser-2/dist/peerpigeon-browser.js +12483 -0
  18. package/examples/browser-2/index.html +2 -1
  19. package/examples/browser-2/package-lock.json +1276 -0
  20. package/examples/browser-2/package.json +5 -3
  21. package/examples/browser-2/public/peerpigeon-browser.js +12483 -0
  22. package/examples/browser-2/src/App.vue +7 -4
  23. package/examples/browser-2/src/components/CryptoView.vue +4 -4
  24. package/examples/browser-2/src/components/TestingView.vue +794 -0
  25. package/examples/browser-2/src/main.js +7 -1
  26. package/examples/browser-2/src/router.js +63 -0
  27. package/examples/browser-2/src/stores/peerpigeon.js +68 -7
  28. package/examples/browser-2/vite.config.js +15 -1
  29. package/examples/stream-file-transfer-demo.html +935 -0
  30. package/package.json +2 -2
  31. package/src/ConnectionManager.js +30 -0
  32. package/src/PeerConnection.js +409 -4
  33. package/src/PeerPigeonMesh.js +120 -1
  34. package/src/SignalingClient.js +12 -5
  35. package/src/browser-entry.js +5 -1
@@ -0,0 +1,496 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>PeerPigeon Binary Message Demo</title>
5
+ <style>
6
+ body {
7
+ font-family: 'Segoe UI', system-ui, sans-serif;
8
+ max-width: 1200px;
9
+ margin: 0 auto;
10
+ padding: 20px;
11
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
12
+ min-height: 100vh;
13
+ }
14
+
15
+ .container {
16
+ background: white;
17
+ border-radius: 12px;
18
+ padding: 30px;
19
+ box-shadow: 0 20px 60px rgba(0,0,0,0.3);
20
+ }
21
+
22
+ h1 {
23
+ color: #667eea;
24
+ margin-top: 0;
25
+ display: flex;
26
+ align-items: center;
27
+ gap: 10px;
28
+ }
29
+
30
+ .status {
31
+ padding: 15px;
32
+ border-radius: 8px;
33
+ margin: 20px 0;
34
+ font-weight: 500;
35
+ }
36
+
37
+ .status.connected {
38
+ background: #d4edda;
39
+ color: #155724;
40
+ border: 1px solid #c3e6cb;
41
+ }
42
+
43
+ .status.disconnected {
44
+ background: #f8d7da;
45
+ color: #721c24;
46
+ border: 1px solid #f5c6cb;
47
+ }
48
+
49
+ .controls {
50
+ display: grid;
51
+ grid-template-columns: 1fr 1fr;
52
+ gap: 20px;
53
+ margin: 20px 0;
54
+ }
55
+
56
+ .panel {
57
+ background: #f8f9fa;
58
+ padding: 20px;
59
+ border-radius: 8px;
60
+ border: 1px solid #dee2e6;
61
+ }
62
+
63
+ .panel h3 {
64
+ margin-top: 0;
65
+ color: #495057;
66
+ }
67
+
68
+ button {
69
+ background: #667eea;
70
+ color: white;
71
+ border: none;
72
+ padding: 12px 24px;
73
+ border-radius: 6px;
74
+ cursor: pointer;
75
+ font-size: 14px;
76
+ font-weight: 500;
77
+ transition: all 0.3s;
78
+ width: 100%;
79
+ margin: 5px 0;
80
+ }
81
+
82
+ button:hover {
83
+ background: #5568d3;
84
+ transform: translateY(-1px);
85
+ box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
86
+ }
87
+
88
+ button:disabled {
89
+ background: #6c757d;
90
+ cursor: not-allowed;
91
+ transform: none;
92
+ }
93
+
94
+ input, textarea {
95
+ width: 100%;
96
+ padding: 10px;
97
+ border: 1px solid #ced4da;
98
+ border-radius: 6px;
99
+ font-size: 14px;
100
+ box-sizing: border-box;
101
+ margin: 5px 0;
102
+ }
103
+
104
+ textarea {
105
+ resize: vertical;
106
+ min-height: 80px;
107
+ }
108
+
109
+ .log {
110
+ background: #1e1e1e;
111
+ color: #d4d4d4;
112
+ padding: 20px;
113
+ border-radius: 8px;
114
+ max-height: 400px;
115
+ overflow-y: auto;
116
+ font-family: 'Courier New', monospace;
117
+ font-size: 13px;
118
+ line-height: 1.6;
119
+ }
120
+
121
+ .log-entry {
122
+ padding: 4px 0;
123
+ border-bottom: 1px solid #333;
124
+ }
125
+
126
+ .log-entry:last-child {
127
+ border-bottom: none;
128
+ }
129
+
130
+ .log-entry.success { color: #4ec9b0; }
131
+ .log-entry.error { color: #f48771; }
132
+ .log-entry.info { color: #9cdcfe; }
133
+ .log-entry.binary { color: #dcdcaa; }
134
+
135
+ .peers-list {
136
+ display: flex;
137
+ gap: 10px;
138
+ flex-wrap: wrap;
139
+ margin: 10px 0;
140
+ }
141
+
142
+ .peer-badge {
143
+ background: #667eea;
144
+ color: white;
145
+ padding: 8px 16px;
146
+ border-radius: 20px;
147
+ font-size: 12px;
148
+ font-weight: 500;
149
+ }
150
+
151
+ .stats {
152
+ display: grid;
153
+ grid-template-columns: repeat(3, 1fr);
154
+ gap: 15px;
155
+ margin: 20px 0;
156
+ }
157
+
158
+ .stat-card {
159
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
160
+ color: white;
161
+ padding: 20px;
162
+ border-radius: 8px;
163
+ text-align: center;
164
+ }
165
+
166
+ .stat-value {
167
+ font-size: 32px;
168
+ font-weight: bold;
169
+ margin: 10px 0;
170
+ }
171
+
172
+ .stat-label {
173
+ font-size: 14px;
174
+ opacity: 0.9;
175
+ }
176
+
177
+ select {
178
+ width: 100%;
179
+ padding: 10px;
180
+ border: 1px solid #ced4da;
181
+ border-radius: 6px;
182
+ font-size: 14px;
183
+ margin: 5px 0;
184
+ background: white;
185
+ }
186
+
187
+ .binary-preview {
188
+ background: #f8f9fa;
189
+ padding: 10px;
190
+ border-radius: 6px;
191
+ margin: 10px 0;
192
+ font-family: 'Courier New', monospace;
193
+ font-size: 12px;
194
+ max-height: 100px;
195
+ overflow-y: auto;
196
+ word-break: break-all;
197
+ }
198
+ </style>
199
+ </head>
200
+ <body>
201
+ <div class="container">
202
+ <h1>
203
+ 📦 PeerPigeon Binary Message Demo
204
+ </h1>
205
+
206
+ <div id="status" class="status disconnected">
207
+ ⏳ Initializing...
208
+ </div>
209
+
210
+ <div class="stats">
211
+ <div class="stat-card">
212
+ <div class="stat-label">Connected Peers</div>
213
+ <div class="stat-value" id="peer-count">0</div>
214
+ </div>
215
+ <div class="stat-card">
216
+ <div class="stat-label">Messages Sent</div>
217
+ <div class="stat-value" id="messages-sent">0</div>
218
+ </div>
219
+ <div class="stat-card">
220
+ <div class="stat-label">Bytes Received</div>
221
+ <div class="stat-value" id="bytes-received">0</div>
222
+ </div>
223
+ </div>
224
+
225
+ <div class="controls">
226
+ <div class="panel">
227
+ <h3>📤 Send Binary Data</h3>
228
+ <label>Select Peer:</label>
229
+ <select id="target-peer">
230
+ <option value="">Broadcast to All</option>
231
+ </select>
232
+
233
+ <label>Data Size (bytes):</label>
234
+ <input type="number" id="data-size" value="1024" min="1" max="1000000">
235
+
236
+ <label>Fill Byte (0-255):</label>
237
+ <input type="number" id="fill-byte" value="42" min="0" max="255">
238
+
239
+ <button onclick="sendRandomBinary()">Send Random Binary</button>
240
+ <button onclick="sendTestPattern()">Send Test Pattern</button>
241
+ <button onclick="sendTextAsBinary()">Send Text as Binary</button>
242
+ </div>
243
+
244
+ <div class="panel">
245
+ <h3>📥 Custom Text Binary</h3>
246
+ <label>Enter text to send as binary:</label>
247
+ <textarea id="text-input" placeholder="Enter text here...">Hello from PeerPigeon! 🐦</textarea>
248
+ <div id="text-preview" class="binary-preview"></div>
249
+ <button onclick="sendCustomText()">Send as Binary</button>
250
+ </div>
251
+ </div>
252
+
253
+ <h3>📜 Activity Log</h3>
254
+ <div id="log" class="log"></div>
255
+
256
+ <div style="margin-top: 20px;">
257
+ <h3>🔗 Connected Peers</h3>
258
+ <div id="peers-list" class="peers-list">
259
+ <span style="color: #666;">No peers connected</span>
260
+ </div>
261
+ </div>
262
+ </div>
263
+
264
+ <script src="../dist/peerpigeon-browser.js"></script>
265
+ <script>
266
+ let mesh = null;
267
+ let messagesSent = 0;
268
+ let bytesReceived = 0;
269
+
270
+ // Initialize
271
+ async function init() {
272
+ log('🚀 Initializing PeerPigeon...', 'info');
273
+
274
+ mesh = new PeerPigeonMesh({
275
+ signalingServer: 'ws://localhost:3000',
276
+ networkName: 'binary-demo',
277
+ autoConnect: true,
278
+ maxPeers: 4,
279
+ debug: true
280
+ });
281
+
282
+ await mesh.connect();
283
+
284
+ setupEventListeners();
285
+ updateTextPreview();
286
+ }
287
+
288
+ function setupEventListeners() {
289
+ mesh.addEventListener('connected', () => {
290
+ updateStatus('connected', '✅ Connected to mesh network');
291
+ log('✅ Connected to signaling server', 'success');
292
+ });
293
+
294
+ mesh.addEventListener('disconnected', () => {
295
+ updateStatus('disconnected', '❌ Disconnected from mesh network');
296
+ log('❌ Disconnected from signaling server', 'error');
297
+ });
298
+
299
+ mesh.addEventListener('peerConnected', (event) => {
300
+ log(`🤝 Peer connected: ${event.peerId.substring(0, 8)}...`, 'success');
301
+ updatePeersList();
302
+ updatePeerCount();
303
+ });
304
+
305
+ mesh.addEventListener('peerDisconnected', (event) => {
306
+ log(`👋 Peer disconnected: ${event.peerId.substring(0, 8)}...`, 'info');
307
+ updatePeersList();
308
+ updatePeerCount();
309
+ });
310
+
311
+ // Binary message handler
312
+ mesh.addEventListener('binaryMessageReceived', (event) => {
313
+ const { from, data, size } = event;
314
+ bytesReceived += size;
315
+
316
+ log(`📦 Binary message received from ${from.substring(0, 8)}... (${size} bytes)`, 'binary');
317
+
318
+ // Try to decode as text
319
+ try {
320
+ const text = new TextDecoder().decode(data);
321
+ if (isPrintableText(text)) {
322
+ log(` 📝 Decoded text: "${text}"`, 'info');
323
+ } else {
324
+ log(` 🔢 Binary data: ${arrayToHex(data.slice(0, 20))}${size > 20 ? '...' : ''}`, 'info');
325
+ }
326
+ } catch (e) {
327
+ log(` 🔢 Binary data: ${arrayToHex(data.slice(0, 20))}${size > 20 ? '...' : ''}`, 'info');
328
+ }
329
+
330
+ updateBytesReceived();
331
+ });
332
+
333
+ // Regular text messages
334
+ mesh.addEventListener('messageReceived', (event) => {
335
+ log(`💬 Text message from ${event.from.substring(0, 8)}...: ${JSON.stringify(event.content)}`, 'info');
336
+ });
337
+ }
338
+
339
+ async function sendRandomBinary() {
340
+ const size = parseInt(document.getElementById('data-size').value);
341
+ const targetPeer = document.getElementById('target-peer').value;
342
+
343
+ // Create random binary data
344
+ const data = new Uint8Array(size);
345
+ crypto.getRandomValues(data);
346
+
347
+ await sendBinaryData(data, targetPeer, 'random');
348
+ }
349
+
350
+ async function sendTestPattern() {
351
+ const size = parseInt(document.getElementById('data-size').value);
352
+ const fillByte = parseInt(document.getElementById('fill-byte').value);
353
+ const targetPeer = document.getElementById('target-peer').value;
354
+
355
+ // Create pattern with repeating byte
356
+ const data = new Uint8Array(size);
357
+ data.fill(fillByte);
358
+
359
+ await sendBinaryData(data, targetPeer, 'pattern');
360
+ }
361
+
362
+ async function sendTextAsBinary() {
363
+ const text = "Quick test message! 🚀";
364
+ await sendTextData(text, document.getElementById('target-peer').value);
365
+ }
366
+
367
+ async function sendCustomText() {
368
+ const text = document.getElementById('text-input').value;
369
+ if (!text) {
370
+ log('❌ No text entered', 'error');
371
+ return;
372
+ }
373
+ await sendTextData(text, document.getElementById('target-peer').value);
374
+ }
375
+
376
+ async function sendTextData(text, targetPeer) {
377
+ const encoder = new TextEncoder();
378
+ const data = encoder.encode(text);
379
+ await sendBinaryData(data, targetPeer, 'text');
380
+ }
381
+
382
+ async function sendBinaryData(data, targetPeer, type) {
383
+ try {
384
+ if (targetPeer) {
385
+ const success = await mesh.sendBinaryData(targetPeer, data);
386
+ if (success) {
387
+ log(`📤 Sent ${type} binary data (${data.length} bytes) to ${targetPeer.substring(0, 8)}...`, 'success');
388
+ messagesSent++;
389
+ updateMessagesSent();
390
+ } else {
391
+ log(`❌ Failed to send to peer`, 'error');
392
+ }
393
+ } else {
394
+ const count = await mesh.broadcastBinaryData(data);
395
+ log(`📤 Broadcasted ${type} binary data (${data.length} bytes) to ${count} peers`, 'success');
396
+ messagesSent++;
397
+ updateMessagesSent();
398
+ }
399
+ } catch (error) {
400
+ log(`❌ Error sending binary data: ${error.message}`, 'error');
401
+ }
402
+ }
403
+
404
+ function updateTextPreview() {
405
+ const text = document.getElementById('text-input').value;
406
+ const encoder = new TextEncoder();
407
+ const bytes = encoder.encode(text);
408
+ const preview = `Size: ${bytes.length} bytes | Hex: ${arrayToHex(bytes.slice(0, 32))}${bytes.length > 32 ? '...' : ''}`;
409
+ document.getElementById('text-preview').textContent = preview;
410
+ }
411
+
412
+ // Update text preview on input
413
+ document.getElementById('text-input').addEventListener('input', updateTextPreview);
414
+
415
+ function updateStatus(state, message) {
416
+ const statusEl = document.getElementById('status');
417
+ statusEl.className = `status ${state}`;
418
+ statusEl.textContent = message;
419
+ }
420
+
421
+ function updatePeerCount() {
422
+ document.getElementById('peer-count').textContent = mesh.getConnectedPeers().length;
423
+ }
424
+
425
+ function updateMessagesSent() {
426
+ document.getElementById('messages-sent').textContent = messagesSent;
427
+ }
428
+
429
+ function updateBytesReceived() {
430
+ document.getElementById('bytes-received').textContent = formatBytes(bytesReceived);
431
+ }
432
+
433
+ function updatePeersList() {
434
+ const peers = mesh.getConnectedPeers();
435
+ const select = document.getElementById('target-peer');
436
+ const peersListEl = document.getElementById('peers-list');
437
+
438
+ // Update dropdown
439
+ const currentValue = select.value;
440
+ select.innerHTML = '<option value="">Broadcast to All</option>';
441
+ peers.forEach(peer => {
442
+ const option = document.createElement('option');
443
+ option.value = peer.peerId;
444
+ option.textContent = peer.peerId.substring(0, 16) + '...';
445
+ select.appendChild(option);
446
+ });
447
+ select.value = currentValue;
448
+
449
+ // Update badges
450
+ if (peers.length === 0) {
451
+ peersListEl.innerHTML = '<span style="color: #666;">No peers connected</span>';
452
+ } else {
453
+ peersListEl.innerHTML = peers.map(peer =>
454
+ `<div class="peer-badge">${peer.peerId.substring(0, 8)}...</div>`
455
+ ).join('');
456
+ }
457
+ }
458
+
459
+ function log(message, type = 'info') {
460
+ const logEl = document.getElementById('log');
461
+ const entry = document.createElement('div');
462
+ entry.className = `log-entry ${type}`;
463
+ entry.textContent = `[${new Date().toLocaleTimeString()}] ${message}`;
464
+ logEl.appendChild(entry);
465
+ logEl.scrollTop = logEl.scrollHeight;
466
+ }
467
+
468
+ function arrayToHex(array) {
469
+ return Array.from(array)
470
+ .map(b => b.toString(16).padStart(2, '0'))
471
+ .join(' ');
472
+ }
473
+
474
+ function isPrintableText(text) {
475
+ // Check if string contains mostly printable characters
476
+ const printable = text.split('').filter(c => {
477
+ const code = c.charCodeAt(0);
478
+ return (code >= 32 && code <= 126) || code === 10 || code === 13;
479
+ }).length;
480
+ return printable / text.length > 0.8;
481
+ }
482
+
483
+ function formatBytes(bytes) {
484
+ if (bytes < 1024) return bytes + ' B';
485
+ if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(1) + ' KB';
486
+ return (bytes / (1024 * 1024)).toFixed(1) + ' MB';
487
+ }
488
+
489
+ // Start the demo
490
+ init().catch(error => {
491
+ log(`❌ Initialization error: ${error.message}`, 'error');
492
+ updateStatus('disconnected', '❌ Failed to initialize');
493
+ });
494
+ </script>
495
+ </body>
496
+ </html>
@@ -0,0 +1,183 @@
1
+ # 🎯 SOLUTION: Use Express Server Instead of Vite Dev Server
2
+
3
+ ## The Problem
4
+
5
+ **Vite's dev server breaks WebRTC ICE negotiation** causing peer connections to fail, while the vanilla browser example works perfectly with Express.
6
+
7
+ ## Why Express Works
8
+
9
+ The vanilla browser example uses a simple Express server (`dev-server.js`) which:
10
+ - ✅ Just serves static files
11
+ - ✅ No HMR WebSocket interference
12
+ - ✅ No module transformation
13
+ - ✅ No middleware conflicts with WebRTC
14
+
15
+ ## Why Vite Fails
16
+
17
+ Vite's dev server has issues with WebRTC:
18
+ - ❌ HMR WebSocket conflicts with PeerPigeon signaling
19
+ - ❌ Module transformation affects timing
20
+ - ❌ Development middleware interferes with ICE candidates
21
+ - ❌ Firefox is particularly strict about these issues
22
+
23
+ ## The Fix: Use Express for Browser-2
24
+
25
+ I've updated the Express server to serve the **built** Vue app, avoiding Vite's dev server entirely.
26
+
27
+ ### Setup Steps
28
+
29
+ 1. **Build browser-2 for production:**
30
+ ```bash
31
+ cd examples/browser-2
32
+ npm run build
33
+ ```
34
+
35
+ This creates `dist/` folder with optimized production build.
36
+
37
+ 2. **Start the Express server (from root):**
38
+ ```bash
39
+ cd ../..
40
+ npm run dev-server
41
+ ```
42
+
43
+ 3. **Open browser-2 via Express:**
44
+ ```
45
+ http://localhost:8080/browser-2
46
+ ```
47
+
48
+ ### URLs Now Available
49
+
50
+ - **Browser (vanilla)**: http://localhost:8080/browser
51
+ - **Browser-2 (Vue)**: http://localhost:8080/browser-2 ✨ NEW
52
+ - **Health check**: http://localhost:8080/health
53
+
54
+ ## Development Workflow
55
+
56
+ ### Option 1: Express Server (RECOMMENDED for testing WebRTC)
57
+
58
+ ```bash
59
+ # Build browser-2
60
+ cd examples/browser-2
61
+ npm run build
62
+
63
+ # Start Express server
64
+ cd ../..
65
+ npm run dev-server
66
+
67
+ # Open http://localhost:8080/browser-2
68
+ ```
69
+
70
+ **Pros:**
71
+ - ✅ WebRTC works perfectly
72
+ - ✅ Same environment as browser example
73
+ - ✅ Production-like performance
74
+
75
+ **Cons:**
76
+ - ❌ No hot reload - must rebuild after changes
77
+ - ❌ Slower iteration
78
+
79
+ ### Option 2: Vite Dev Server (for UI development only)
80
+
81
+ ```bash
82
+ cd examples/browser-2
83
+ npm run dev
84
+
85
+ # Open http://localhost:5173
86
+ ```
87
+
88
+ **Pros:**
89
+ - ✅ Hot Module Reload
90
+ - ✅ Fast iteration
91
+ - ✅ Good for UI/styling work
92
+
93
+ **Cons:**
94
+ - ❌ WebRTC connections fail (ICE issues)
95
+ - ❌ Can't test peer functionality
96
+ - ❌ Not suitable for integration testing
97
+
98
+ ## Recommended Approach
99
+
100
+ **For development:**
101
+ 1. Use Vite dev server (`npm run dev`) for UI changes
102
+ 2. Don't worry about WebRTC not working in dev mode
103
+
104
+ **For testing:**
105
+ 1. Build (`npm run build`)
106
+ 2. Use Express server (`npm run dev-server` from root)
107
+ 3. Test at http://localhost:8080/browser-2
108
+
109
+ **For production:**
110
+ 1. Build (`npm run build`)
111
+ 2. Serve `dist/` folder with any static file server
112
+ 3. WebRTC will work correctly
113
+
114
+ ## Quick Commands Reference
115
+
116
+ ```bash
117
+ # From examples/browser-2/
118
+
119
+ # Build for production
120
+ npm run build
121
+
122
+ # Start Vite dev (UI development only)
123
+ npm run dev
124
+
125
+ # Preview production build
126
+ npm run preview
127
+
128
+ # From project root/
129
+
130
+ # Start Express server (serves both examples)
131
+ npm run dev-server
132
+
133
+ # Start signaling server
134
+ npm run dev-server # It's the same command
135
+ ```
136
+
137
+ ## Testing Peer Connections
138
+
139
+ 1. **Build browser-2:**
140
+ ```bash
141
+ cd examples/browser-2 && npm run build && cd ../..
142
+ ```
143
+
144
+ 2. **Start Express server:**
145
+ ```bash
146
+ npm run dev-server
147
+ ```
148
+
149
+ 3. **Open multiple tabs:**
150
+ - Tab 1: http://localhost:8080/browser (vanilla)
151
+ - Tab 2: http://localhost:8080/browser-2 (Vue)
152
+ - Tab 3: http://localhost:8080/browser-2 (Vue)
153
+
154
+ 4. **Click "Connect" in each tab**
155
+
156
+ 5. **Watch peers connect!** 🎉
157
+
158
+ You should see:
159
+ ```
160
+ 🔍 PEER DISCOVERED EVENT
161
+ 🤝 PEER CONNECTED EVENT ← This will now work!
162
+ ```
163
+
164
+ ## Updated Documentation
165
+
166
+ The main README and QUICK_START.md have been updated to reflect this approach.
167
+
168
+ ## Why This Is The Right Solution
169
+
170
+ 1. **Proven to work** - Express server works perfectly for browser example
171
+ 2. **Production-like** - Testing against production build is more reliable
172
+ 3. **Simple** - No complex Vite configuration hacks
173
+ 4. **Maintainable** - Clear separation between dev (Vite) and test (Express)
174
+
175
+ ## Future Improvements
176
+
177
+ Consider creating a `dev-server-watch.js` that:
178
+ - Watches for file changes in browser-2
179
+ - Auto-rebuilds on change
180
+ - Serves via Express
181
+ - Best of both worlds: auto-rebuild + WebRTC working
182
+
183
+ For now, manual rebuild + Express is the reliable solution! 🚀