Files
frigate/frigate/comms/base_communicator.py
T

23 lines
580 B
Python
Raw Normal View History

2025-02-10 20:47:15 -06:00
from abc import ABC, abstractmethod
2026-07-06 09:28:02 -08:00
from collections.abc import Callable
from typing import Any
2025-02-10 20:47:15 -06:00
class Communicator(ABC):
"""pub/sub model via specific protocol."""
@abstractmethod
def publish(self, topic: str, payload: Any, retain: bool = False) -> None:
"""Send data via specific protocol."""
pass
@abstractmethod
def subscribe(self, receiver: Callable) -> None:
"""Pass receiver so communicators can pass commands."""
pass
@abstractmethod
def stop(self) -> None:
"""Stop the communicator."""
pass