Now reporting chat messages via MQTT.

This commit is contained in:
Marat Fayzullin 2024-08-02 19:14:35 -04:00
parent aa0e7513ab
commit 2bdcdc034d
1 changed files with 9 additions and 0 deletions

View File

@ -1,5 +1,6 @@
from owrx.config import Config
from owrx.color import ColorCache
from owrx.reporting import ReportingEngine
from datetime import datetime, timedelta
from ipaddress import ip_address
import threading
@ -104,6 +105,14 @@ class ClientRegistry(object):
self.chat[client] = { "name": name, "color": color }
self.chatCount = self.chatCount + 1
# Report message
ReportingEngine.getSharedInstance().spot({
"mode" : "CHAT",
"timestamp" : round(datetime.now().timestamp() * 1000),
"name" : name,
"message" : text
})
# Broadcast message to all clients
for c in self.clients:
c.write_chat_message(name, text, color)