5.1 KiB
Quick Fix for Multi-User Display Issues
The Problem
Your PHP SSE (Server-Sent Events) setup isn't working because:
- PHP-FPM buffers output - Shared hosting uses PHP-FPM which buffers everything
- Apache/Nginx timeouts - Proxy kills long connections
- SSE isn't designed for PHP - PHP processes are meant to be short-lived
The Solutions (in order of recommendation)
✅ Solution 1: Use PHP Polling (Easiest Fix)
What changed: Instead of SSE (streaming), use regular HTTP polling every 1 second
Files affected:
- Keep:
server.php,config.php(no changes needed) - Replace: Use
display-polling.phpinstead ofdisplay.php
Setup:
- Upload
display-polling.phpto your server - Change your OBS Browser Source URL from:
OLD: https://your-site.com/transcription/display.php?room=ROOM NEW: https://your-site.com/transcription/display-polling.php?room=ROOM - Done! No other changes needed.
Pros:
- ✅ Works on ANY shared hosting
- ✅ No server configuration needed
- ✅ Uses your existing setup
- ✅ 5-minute fix
Cons:
- ⚠️ 1-2 second latency (vs instant with WebSocket)
- ⚠️ More server requests (but minimal impact)
Performance: Good for 2-20 concurrent users
⭐ Solution 2: Use Node.js Server (Best Performance)
What changed: Switch from PHP to Node.js - designed for real-time
Setup:
- Get a VPS (or use free hosting like Railway.app)
- Install Node.js:
cd server/nodejs npm install npm start - Update desktop app Server URL to:
http://your-server.com:3000/api/send - Update OBS URL to:
http://your-server.com:3000/display?room=ROOM
Pros:
- ✅ Real-time (< 100ms latency)
- ✅ Handles 100+ users easily
- ✅ Native WebSocket support
- ✅ Lower resource usage
- ✅ Can use free hosting (Railway, Heroku, Fly.io)
Cons:
- ❌ Requires VPS or cloud hosting (can't use shared hosting)
- ❌ More setup than PHP
Performance: Excellent for any number of users
Free Hosting Options:
- Railway.app (easiest - just connect GitHub)
- Heroku (free tier)
- Fly.io (free tier)
🔧 Solution 3: Fix PHP SSE (Advanced - Not Recommended)
Only if you have full server control and really want SSE
This requires:
- Apache configuration changes
- Disabling output buffering
- Increasing timeouts
See apache-sse-config.conf for details.
Not recommended because: It's complex, fragile, and PHP polling is easier and more reliable.
Quick Comparison
| Solution | Setup Time | Reliability | Latency | Works on Shared Hosting? |
|---|---|---|---|---|
| PHP Polling | 5 min | ⭐⭐⭐⭐⭐ | 1-2s | ✅ Yes |
| Node.js | 30 min | ⭐⭐⭐⭐⭐ | < 100ms | ❌ No (needs VPS) |
| PHP SSE | 2 hours | ⭐⭐ | Should be instant | ❌ Rarely |
Testing Your Fix
Test PHP Polling
-
Run the test script:
cd server ./test-server.sh -
Or manually:
# Send a test message curl -X POST "https://your-site.com/transcription/server.php?action=send" \ -H "Content-Type: application/json" \ -d '{ "room": "test", "passphrase": "testpass", "user_name": "TestUser", "text": "Hello World", "timestamp": "12:34:56" }' # Open in browser: https://your-site.com/transcription/display-polling.php?room=test # Should see "Hello World" appear within 1-2 seconds
Test Node.js
-
Start server:
cd server/nodejs npm install npm start -
Open browser:
http://localhost:3000/display?room=test -
Send test message:
curl -X POST "http://localhost:3000/api/send" \ -H "Content-Type: application/json" \ -d '{ "room": "test", "passphrase": "testpass", "user_name": "TestUser", "text": "Hello World", "timestamp": "12:34:56" }' -
Should see message appear instantly
My Recommendation
Start with PHP Polling (Solution 1):
- Upload
display-polling.php - Change OBS URL
- Test it out
If you like it and want better performance, migrate to Node.js (Solution 2):
- Takes 30 minutes
- Much better performance
- Can use free hosting
Forget about PHP SSE (Solution 3):
- Too much work
- Unreliable
- Not worth it
Files You Need
For PHP Polling
- ✅
server.php(already have) - ✅
config.php(already have) - ✅
display-polling.php(NEW - just created) - ❌
display.php(don't use anymore)
For Node.js
- ✅
server/nodejs/server.js(NEW) - ✅
server/nodejs/package.json(NEW) - ✅
server/nodejs/README.md(NEW)
Need Help?
- Read COMPARISON.md for detailed comparison
- Read server/nodejs/README.md for Node.js setup
- Run
./test-server.shto diagnose issues - Check browser console for errors
Bottom Line
Your SSE display doesn't work because PHP + shared hosting + SSE = bad combo.
Use PHP Polling (1-2s delay) or Node.js (instant). Both work reliably.