- added stream talker

- added stream listener
This commit is contained in:
2026-03-28 12:03:54 +01:00
parent 2e01a70d53
commit 8208edfc46
6 changed files with 54 additions and 42 deletions
+9
View File
@@ -0,0 +1,9 @@
from abc import ABC, abstractmethod
class StreamListener(ABC):
def __init__(self):
pass
@abstractmethod
def on_recv(self, data: bytes):
pass
+13
View File
@@ -0,0 +1,13 @@
from abc import ABC
from stream.listener import StreamListener
class StreamTalker(ABC):
def __init__(self):
self.sinks = []
def register_listener(self, sink: StreamListener):
self.sinks.append(sink)
def call_listener(self, data: bytes):
for sink in self.sinks:
sink.on_recv(data)