changedetectionio/realtime/README.md
This directory contains the Socket.IO implementation for changedetection.io's real-time updates.
The real-time system provides live updates to the web interface for:
threading (default) or gevent (optional via SOCKETIO_MODE env var)SOCKETIO_MODE=threading (default, recommended)SOCKETIO_MODE=gevent (optional, has cross-platform limitations)Eventlet was completely removed due to fundamental compatibility issues:
Monkey Patching Conflicts: eventlet.monkey_patch() globally replaced Python's threading/socket modules, causing conflicts with:
Python 3.12+ Compatibility: Eventlet had issues with newer Python versions and asyncio integration
CVE-2023-29483: Security vulnerability in eventlet's dnspython dependency
✅ Threading Mode Advantages:
✅ Optional Gevent Support:
SOCKETIO_MODE=gevent for high-concurrency scenarios# Enabled automatically
async_mode = 'threading'
socketio = SocketIO(app, async_mode='threading')
# Set environment variable
export SOCKETIO_MODE=gevent
threading.Thread with threading.Event for shutdownemit() calls to connected clientssocket_server.py: Main Socket.IO initialization and event handlingevents.py: Watch operation event handlers__init__.py: Module initializationFor production with Socket.IO threading mode:
gunicorn --worker-class eventlet changedetection:app (if using gevent mode)| Variable | Default | Description |
|---|---|---|
SOCKETIO_MODE | threading | Socket.IO async mode (threading or gevent) |
FETCH_WORKERS | 10 | Number of async workers for watch processing |
CHANGEDETECTION_HOST | 0.0.0.0 | Server bind address |
CHANGEDETECTION_PORT | 5000 | Server port |
ps -T to check thread count/worker-health endpoint to check async worker status/queue-status endpoint to monitor job queue/gc-cleanup endpoint to trigger memory cleanupIf upgrading from eventlet-based versions:
EVENTLET_* environment variablesSOCKETIO_MODE=gevent if high concurrency is required and platform supports it