Chat, live notifications, user presence statuses and updates in Discuss, Helpdesk or Point of Sale all require real-time communication in Odoo. If, after deploying to a production server, these features do not work or only refresh after you reload the page, it usually means the process that handles long-lived connections or the reverse proxy is misconfigured. In this guide, we show how to enable longpolling in the latest version of Odoo and how to configure Nginx correctly.
Want to see how notifications and chat work in Odoo before you start configuring your own server? Try the system for free.
What are longpolling and websocket in Odoo?
Historically, Odoo used a longpolling mechanism, meaning long HTTP requests on which the server kept the connection open until a new event appeared. In newer releases, including Odoo 19, real-time communication is based on the websocket protocol served at /websocket. In practice, administrators still talk about longpolling, and the configuration comes down to the same elements: a separate gevent process, a dedicated port and a properly configured proxy.
Long-lived connections are handled by a dedicated gevent process, which listens on port 8072 by default. Regular workers handle requests on port 8069 and are not suited to holding many open connections at the same time. The gevent process runs alongside the HTTP workers and is not counted in the value of the workers parameter.
Prerequisites
- A working Odoo 19 installation (e.g., on Ubuntu, Debian or CentOS/RHEL).
- Access to the configuration file, e.g.
/etc/odoo.conf. - Permissions to restart the Odoo service and to configure Nginx.
- Multiprocessing mode enabled (the
workersparameter set to a value greater than 0).
How to enable longpolling in the configuration file
Step 1: set the number of workers
The gevent process starts automatically only when Odoo runs in multiprocessing mode. With workers = 0, the server runs in multithreaded mode and websocket is handled on the main port 8069. That is enough for a test environment, but not for production. The number of workers depends on the number of CPU cores, the amount of RAM and the number of concurrent users. As a rough upper limit, use (2 × number of cores) + 1, and a good starting point on a smaller server is 2 to 4 workers. You should then fine-tune the value based on load monitoring.
Step 2: add the parameters to odoo.conf
[options]
workers = 2
gevent_port = 8072
proxy_mode = True
http_interface = 127.0.0.1
The gevent_port parameter replaced the old longpolling_port option, so if you are using an old configuration, update the name. The proxy_mode = True option is required when Odoo sits behind Nginx or another reverse proxy, because it allows Odoo to correctly read the headers passed by the proxy. Setting http_interface = 127.0.0.1 makes Odoo accept connections only from the local proxy, so it is not directly reachable from the network. Skip it if Nginx runs on a different server.
Step 3: restart the service
sudo systemctl restart odoo
sudo ss -tlnp | grep -E '8069|8072'
If both ports appear as listening, the gevent process is working correctly.
Nginx configuration for websocket
Starting the gevent process is not enough on its own. The reverse proxy must route the /websocket path to port 8072 and all other traffic to port 8069. You also need to pass the Upgrade and Connection headers, without which the websocket handshake will fail.
upstream odoo {
server 127.0.0.1:8069;
}
upstream odoochat {
server 127.0.0.1:8072;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
server_name erp.example.com;
location /websocket {
proxy_pass http://odoochat;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_read_timeout 3600s;
}
location / {
proxy_pass http://odoo;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
}
The proxy_read_timeout directive extends the time Nginx keeps an idle websocket connection open, so it is not dropped prematurely. The example above uses port 80 for simplicity only. In production, configure the server block with listen 443 ssl and an SSL certificate (e.g., Let's Encrypt), and add a redirect from port 80 to HTTPS. The browser will then connect to Odoo over the secure wss protocol.
After saving the file, check the syntax with sudo nginx -t and reload the service: sudo systemctl reload nginx. If you run multiple Odoo instances, also see our guide on how to configure an Nginx load balancer for Odoo. In such a setup, pay special attention to making sure websocket connections reach the gevent process rather than a regular worker on port 8069, and that user sessions are consistently routed to the same instance.
A proxy configuration with multiple instances or an SSL certificate can cause trouble even for experienced administrators. If you prefer to leave it to specialists, contact our team.
Firewall and security
Port 8072 should not be publicly exposed. Internet traffic should reach only Nginx on ports 80 and 443, while Odoo on ports 8069 and 8072 should listen locally or be accessible only to the proxy. You can find detailed rules in the article how to configure a firewall for Odoo.
How to check that real-time communication works
- Log in to Odoo with two different accounts (e.g., in a regular window and an incognito window).
- Open the Discuss app and send a message from one account to the other.
- If the message appears instantly, without refreshing the page, websocket is working correctly.
- Additionally, open your browser's developer tools, go to the Network tab and use the WS filter. You should see a connection to
/websocket(with the wss:// prefix over HTTPS) and a 101 Switching Protocols status.
Most common problems and their solutions
No connection to /websocket
Check that Nginx passes the Upgrade and Connection headers and that the /websocket path points to port 8072. This is the most common cause of errors. A typical symptom is a 400 or 502 error on this path, or no 101 status in the Network tab, especially when workers is greater than 0 and websocket traffic reaches port 8069. If you see a connection refused message, the following article will help: Odoo Connection Refused Error.
The gevent process does not start
Make sure workers is greater than 0 and that port 8072 is not in use by another service. Look for the cause in the logs, and if you have not yet set up logging to a file, use the guide how to configure logging to a file in Odoo.
Invalid address or certificate errors
When accessing over HTTPS, make sure the X-Forwarded-Proto header is set to https and that proxy_mode is enabled in Odoo. Otherwise, the browser may block the connection as insecure.
Best practices
- Adjust the number of workers to your server resources and the number of users using the system at the same time.
- Set reasonable memory and processing time limits (
limit_memory_soft,limit_memory_hard,limit_time_cpu,limit_time_real). - Monitor the Nginx and Odoo logs after every configuration change.
- Test changes in a staging environment first.
- Keep Odoo and the operating system up to date.
FAQ – frequently asked questions
Is longpolling still needed in Odoo 19?
Classic longpolling has been replaced by websocket, but the infrastructure requirements remain similar. You still need a separate gevent process on port 8072 and a properly configured proxy for the /websocket path.
Which port does real-time communication use in Odoo?
By default it is port 8072, set with the gevent_port parameter. The main application runs on port 8069. Port 8072 should not be directly accessible from the internet.
Can I use these features without Nginx?
Yes, with workers = 0 websocket runs on port 8069, which works for testing or small development environments. In production, we recommend multiprocessing mode with a reverse proxy, which provides performance, SSL and security.
Summary
To enable longpolling in Odoo, set workers to a value greater than 0, configure gevent_port and proxy_mode, and then add a separate /websocket location in Nginx that routes traffic to port 8072. Complete the setup with firewall rules and a test using two user accounts.
Want to see how real-time communication works in a ready-to-use Odoo environment? Test the system for free.
Need help with implementing, optimizing or migrating Odoo? The KK Innovations team will be happy to help you configure your environment so that it runs fast, stable and secure. Write to us today.