Daily updates from Odoo
Wednesday, June 11, 2025
1 change
Code cleanup and technical improvements
This change streamlines how Odoo communicates with IoT Boxes by replacing separate communication services with one shared approach. It should make IoT-related operations such as printing, device actions, weighing, and delivery package workflows more consistent and easier to maintain.
Original PR description
### The communication between the IoT Box and a DB can be done using: - Longpolling, - Websocket, - Simple fetch from one side or the other. ### Problems: - The longpolling and the websocket can…
### The communication between the IoT Box and a DB can be done using: - Longpolling, - Websocket, - Simple fetch from one side or the other. ### Problems: - The longpolling and the websocket can theorically be substituted but don't have a common API, - The websocket service is currently designed to handle ONLY printing jobs, - The longpolling is barely used, often replaced by a simple "action", but never polling (~never listening for response from the IoT Box), ### Solution: We refactored all this in order to simplify the communication. - `iot_longpolling` and `iot_websocket` services are replaced by a single `iot_http` service exposing available methods, - Websocket can now call every IoT Box _action method_, - Longpolling and Websocket now have a common simple API (`sendMessage`/`onMessage`), - Longpolling can now fallback to websocket on every call (via `action` method), #### List of the methods: - `get`/`post`: base http methods to properly contact an IoT Box from the db client, - `websocket.sendMessage`/`websocket.onMessage`: websocket methods, - `longpolling.sendMessage`/`lonpolling.onMessage`: longpolling methods (+ `lonpolling.addListener`/`lonpolling.removeListener` kept for compatibility), - `action`: general method to properly handle a simple communication between the db and the IoT Box, Community PR: [https://github.com/odoo/odoo/pull/185506](https://github.com/odoo/odoo/pull/185506) Task: 4283647