Skip to content

Commit

Permalink
constrain websockets to frigate topics
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeblackshear committed Feb 20, 2021
1 parent 26a3491 commit 57ced2c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions frigate/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ def register(self, client):

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:
Expand Down

0 comments on commit 57ced2c

Please sign in to comment.