Updated MQTT message states.

This commit is contained in:
Marat Fayzullin 2024-08-03 12:55:11 -04:00
parent 75927656be
commit 507f43df16
2 changed files with 7 additions and 7 deletions

View File

@ -146,12 +146,12 @@ Support and info: https://groups.io/g/openwebrx
# Instantiate and refresh marker database # Instantiate and refresh marker database
Markers.start() Markers.start()
# Report receiver started # Report server started
ReportingEngine.getSharedInstance().spot({ ReportingEngine.getSharedInstance().spot({
"mode" : "RX", "mode" : "RX",
"timestamp" : round(datetime.now().timestamp() * 1000), "timestamp" : round(datetime.now().timestamp() * 1000),
"version" : openwebrx_version, "version" : openwebrx_version,
"state" : "ReceiverStarted" "state" : "ServerStarted"
}) })
try: try:
@ -183,12 +183,12 @@ Support and info: https://groups.io/g/openwebrx
SdrService.stopAllSources() SdrService.stopAllSources()
DecoderQueue.stopAll() DecoderQueue.stopAll()
# Report receiver stopped # Report server stopped
ReportingEngine.getSharedInstance().spot({ ReportingEngine.getSharedInstance().spot({
"mode" : "RX", "mode" : "RX",
"timestamp" : round(datetime.now().timestamp() * 1000), "timestamp" : round(datetime.now().timestamp() * 1000),
"version" : openwebrx_version, "version" : openwebrx_version,
"state" : "ReceiverStopped" "state" : "ServerStopped"
}) })
# Done with reporting now # Done with reporting now

View File

@ -52,13 +52,13 @@ class ClientRegistry(object):
raise TooManyClientsException() raise TooManyClientsException()
self.clients.append(client) self.clients.append(client)
self.broadcast() self.broadcast()
self.reportClient(client, { "state":"CONNECTED" }) self.reportClient(client, { "state":"Connected" })
def clientCount(self): def clientCount(self):
return len(self.clients) return len(self.clients)
def removeClient(self, client): def removeClient(self, client):
self.reportClient(client, { "state":"DISCONNECTED" }) self.reportClient(client, { "state":"Disconnected" })
try: try:
if client in self.chat: if client in self.chat:
del self.chat[client] del self.chat[client]
@ -88,7 +88,7 @@ class ClientRegistry(object):
def reportChatMessage(self, client, text: str): def reportChatMessage(self, client, text: str):
name = self.chat[client]["name"] if client in self.chat else "???" name = self.chat[client]["name"] if client in self.chat else "???"
self.reportClient(client, { self.reportClient(client, {
"state" : "CHAT", "state" : "ChatMessage",
"name" : name, "name" : name,
"message" : text "message" : text
}) })