Skip to content

Commit

Permalink
rename mqtt module
Browse files Browse the repository at this point in the history
  • Loading branch information
linomp committed Mar 28, 2024
1 parent f131004 commit d5a6a4c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@ class MqttClient:
__client__: paho.Client = None

def __init__(self):

# TODO refactor this dirty hack!!
if MQTT_USER is None:
return
return

client = paho.Client(client_id="pdmgame_server", userdata=None, protocol=paho.MQTTv5,
callback_api_version=CallbackAPIVersion.VERSION2)
client.on_connect = on_connect
Expand All @@ -48,4 +46,9 @@ def __init__(self):
self.__client__ = client

def publish_parameter(self, client_uid: str, parameter_name: str, payload: float):
self.__client__.publish(f"{MQTT_TOPIC_PREFIX}/{client_uid}/{parameter_name}", payload=payload, qos=1)
if self.__client__ is None:
return

self.__client__.publish(
f"{MQTT_TOPIC_PREFIX}/{client_uid}/{parameter_name}", payload=payload, qos=1
)
2 changes: 1 addition & 1 deletion mvp/server/routers/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from mvp.server.core.game.GameMetrics import GameMetrics
from mvp.server.core.game.GameSession import GameSession
from mvp.server.core.game.GameSessionDTO import GameSessionDTO
from mvp.server.mqtt.client import MqttClient
from mvp.server.messaging.mqtt_client import MqttClient

sessions: dict[str, GameSession] = {}
game_metrics = GameMetrics()
Expand Down

0 comments on commit d5a6a4c

Please sign in to comment.