Why Longpolling Breaks
Odoo's real-time features — live chat, discuss, bus notifications, POS sync — depend on persistent HTTP connections or WebSockets. The standard Odoo threaded or prefork worker cannot hold these open efficiently. A separate gevent worker is required, listening on port 8072 by default, and nginx must forward /longpolling/ (Odoo 14/15) or /websocket (Odoo 16+) requests to that port.
If you skip any one of these steps, Odoo silently falls back to polling or shows a disconnected indicator.
Step 1 — Install gevent
# In your Odoo virtual environment
pip install gevent
# Verify
python -c "import gevent; print(gevent.__version__)"
Docker images from Odoo SA include gevent by default. If you built a custom image, ensure it is in your requirements.txt.
Step 2 — Configure odoo.conf
[options]
workers = 4 # must be > 0 for gevent to activate
gevent_port = 8072 # longpolling port
The gevent worker only starts when workers is set to 1 or more. In threaded mode (workers = 0), longpolling falls back to a basic implementation that does not scale.
Step 3 — Open Port 8072 (or keep it internal)
Port 8072 does not need to be publicly accessible. nginx will proxy to it internally. If you are using a firewall, ensure the nginx server can reach 127.0.0.1:8072:
# Test from the server itself
curl -I http://127.0.0.1:8072/longpolling/poll
Step 4 — Configure nginx (Odoo 14 / 15)
upstream odoo {
server 127.0.0.1:8069;
}
upstream odoo_longpolling {
server 127.0.0.1:8072;
}
server {
listen 443 ssl;
server_name odoo.example.com;
location /longpolling/ {
proxy_pass http://odoo_longpolling;
proxy_read_timeout 600s;
proxy_http_version 1.1;
}
location / {
proxy_pass http://odoo;
proxy_read_timeout 300s;
}
}
The long proxy_read_timeout on /longpolling/ is intentional — these connections stay open for up to several minutes waiting for events.
Step 5 — Configure nginx (Odoo 16 / 17 / 18 / 19 — WebSocket)
Odoo 16 replaced longpolling with WebSockets. The nginx config needs the Upgrade header forwarded:
location /websocket {
proxy_pass http://odoo_longpolling;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400s;
}
location /longpolling/ {
proxy_pass http://odoo_longpolling;
proxy_read_timeout 600s;
}
Both blocks are needed during the Odoo 16 transition period. From Odoo 17 onwards, /websocket is the primary path.
Step 6 — Verify It Is Working
# Check gevent worker process is running
ps aux | grep "gevent\|8072"
# Watch the gevent log
tail -f /var/log/odoo/odoo.log | grep -i "gevent\|longpolling\|websocket"
# In browser DevTools: Network tab, filter by WS or longpolling
# You should see a persistent connection with status 101 (WebSocket) or 200 (longpolling)
Docker-Specific Notes
If Odoo runs in Docker, both ports 8069 and 8072 must be exposed to the nginx container (or host). In docker-compose.yml:
services:
odoo:
ports:
- "127.0.0.1:8069:8069"
- "127.0.0.1:8072:8072"
Or if nginx is also in Docker on the same network, use the service name as the upstream: proxy_pass http://odoo:8072;.
How DeployMonkey Configures This
Every DeployMonkey instance is provisioned with gevent workers enabled and nginx pre-configured with both the standard and WebSocket upstreams. You do not need to touch nginx or odoo.conf — live chat and bus notifications work immediately after deployment. See Configure Odoo Workers for the full worker setup guide.
Start free at deploymonkey.app.
Frequently Asked Questions
How do I know if gevent is actually running?
Run ps aux | grep odoo. You should see multiple worker processes plus one labelled gevent or showing port 8072 in ss -tlnp.
Live chat connects but messages are delayed — why?
The WebSocket or longpolling connection is working but the gevent worker is overloaded. Increase workers or check that the gevent worker is not hitting limit_memory_hard.
Does longpolling work in Odoo.sh?
Yes — Odoo.sh handles all of this automatically. The configuration described here applies to self-hosted deployments.
My nginx returns 502 on /websocket — what is wrong?
The gevent worker is not running or not reachable on port 8072. Confirm with curl http://127.0.0.1:8072/websocket from the server and check the Odoo log for startup errors.