mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
constrain websockets to frigate topics
This commit is contained in:
parent
26a3491466
commit
57ced2c284
@ -40,14 +40,14 @@ class MqttBackend():
|
||||
|
||||
def publish(self, message):
|
||||
json_message = json.loads(message)
|
||||
self.mqtt_client.publish(json_message['topic'], json_message['payload'], retain=json_message['retain'])
|
||||
self.mqtt_client.publish(f"{self.topic_prefix}/{json_message['topic']}", json_message['payload'], retain=json_message['retain'])
|
||||
|
||||
def run(self):
|
||||
def send(client, userdata, message):
|
||||
"""Sends mqtt messages to clients."""
|
||||
try:
|
||||
ws_message = json.dumps({
|
||||
'topic': message.topic,
|
||||
'topic': message.topic.replace(f"{self.topic_prefix}/",""),
|
||||
'payload': message.payload.decode()
|
||||
})
|
||||
except:
|
||||
|
Loading…
Reference in New Issue
Block a user