[FIX] iot: Build the url of iot_channel with dumps

Before, the url was built with string comprehension.
Now json.dumps is use to ensure that the JSON sent is
valid

closes odoo/odoo#144125

Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
This commit is contained in:
vifo
2023-11-30 14:48:13 +00:00
parent 836151f38c
commit 391eac2447
+1 -1
View File
@@ -61,7 +61,7 @@ class WebsocketClient(Thread):
When the client is setup, this function send a message to subscribe to the iot websocket channel
"""
ws.send(
'{"event_name":"subscribe","data":{"channels":["' + self.iot_channel + '"],"last":0}}'
json.dumps({'event_name': 'subscribe', 'data': {'channels':[self.iot_channel], 'last': 0}})
)
def __init__(self, url):