Longpolling in Odoo 19 is essential to enable real-time notifications for features such as instant notifications, messaging, and live chat to all connected users. Longpolling allows the server to push periodic updates for all connected users when new data is available on the backend. This keeps all users in sync with what is happening in their organization without needing to manually refresh the browser.
If longpolling has not been configured correctly, it can result in a very different experience for users using Odoo 19 and may allow users to not receive their notifications/messages immediately, creating a negative experience on the platform. Longpolling enhances communication between users and provides a means for more timely delivery of real-time updates throughout the system. In this blog, you'll learn how to configure and enable longpolling in Odoo 19 to ensure smooth real-time notifications and communication.
Understanding and Enabling Longpolling in Odoo 19
Long polling is a connection technique Odoo uses to send real-time information to users who are connected at the time the information becomes available. It is an essential feature for applications that generate real-time updates, such as Discuss, Live Chat, and Notifications, which display information immediately after it is received. Using long polling allows you to keep up-to-date on collaborative processes and for the system to remain responsive.
Before you can enable long polling on your Odoo 19 instance, you will need to ensure that your instance is operational and that you can access the server where Odoo has been installed. You will also need to have access to the Odoo configuration file. If your Odoo is running behind a reverse proxy, you will need to ensure that the appropriate configuration of your web server has been completed.
Open the Odoo Configuration file and set the long polling evented port to the one you want to use.
[options]
http_port = 8069
gevent_port = 8072
Odoo 19 uses the gevent_port parameter to control longpolling connections. Odoo listens to standard web requests on port 8069 and serves longpolling requests on port 8072 by default.
After making the necessary changes to the configuration file, restart the Odoo service to activate the updated configuration.
sudo systemctl restart odoo
You can verify that the longpolling port is active by running the following command:
sudo netstat -tulpn | grep 8072
If the configuration is successful, the output will show that Odoo is listening on port 8072. When Odoo is behind Nginx, longpolling requests must also be forwarded to the gevent port via the reverse proxy configuration.
Configuring Nginx for Longpolling
If your Odoo 19 instance is behind Nginx, longpolling requests should be redirected to the gevent port. This setup is needed so that real-time features such as notifications and live chat work as expected. This means that the reverse proxy must be configured to forward longpolling traffic to port 8072.
Add this location block to your Nginx configuration file:
location /websocket {
proxy_pass http://127.0.0.1:8072;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header 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;
}After saving the changes, reload the Nginx service to apply the updated configuration.
sudo systemctl restart nginx
To verify the configuration that has been completed correctly, please complete the following steps:
The first step to confirm the configuration is to restart Odoo and Nginx with the commands:
- sudo service odoo restart
- systemctl restart nginx
- Next, go into "Discuss" and check that you see the messages being received as soon as they are sent and that you are seeing an immediate notification of those messages without the need to refresh the page.
- Lastly, check your log files on the server for any issues.
Each of these validation points will help to identify if the longpolling configuration is working correctly and providing real-time communication.
Benefits of Enabling Longpolling In Odoo 19
Longpolling has the potential to provide users of Odoo 19 with an increase in the overall responsiveness of some modules that rely on real-time communication. Users are no longer left waiting for a page to refresh to receive an update; they receive updates immediately. This results in smoother workflows and more efficient day-to-day operations.
There Are Benefits of Enabling Longpolling:
- Quicker notifications and alerts.
- Immediate updates from the Talk Module.
- Better user experience with Live Chat.
- Increased collaboration between team members.t
- Fewer instances of having to manually refresh pages.
- Increased responsiveness of communications throughout Odoo.
When your longpolling system is configured properly, your company can feel confident that users will receive time-sensitive information on time, leading to better communication and collaboration amongst your users.
To enable real-time communication in Odoo 19 using Longpolling, ensure that the gevent port is configured correctly and the reverse proxy is set up properly. This allows users to access applications such as Discuss, Live Chat, and Notifications with minimal latency. By properly implementing long-polling (by both the service provider and the client), a business will create a better overall experience for the user and facilitate enhanced collaboration within the system itself.
To read more about Overview of Performance Tuning in Odoo 19 Worker Configuration, refer to our blog Overview of Performance Tuning in Odoo 19 Worker Configuration.