Module livekit.agents.ipc.channel
Functions
async def arecv_message(dplx: utils.aio.duplex_unix._AsyncDuplex, messages: MessagesDict) ‑> Message-
Expand source code
async def arecv_message( dplx: utils.aio.duplex_unix._AsyncDuplex, messages: MessagesDict ) -> Message: return _read_message(await dplx.recv_bytes(), messages) async def asend_message(dplx: utils.aio.duplex_unix._AsyncDuplex,
msg: Message) ‑> None-
Expand source code
async def asend_message(dplx: utils.aio.duplex_unix._AsyncDuplex, msg: Message) -> None: await dplx.send_bytes(_write_message(msg)) def read_bool(b: io.BytesIO) ‑> bool-
Expand source code
def read_bool(b: io.BytesIO) -> bool: return bool.from_bytes(b.read(1), "big") def read_bytes(b: io.BytesIO) ‑> bytes-
Expand source code
def read_bytes(b: io.BytesIO) -> bytes: length = int.from_bytes(b.read(4), "big") return b.read(length) def read_double(b: io.BytesIO) ‑> float-
Expand source code
def read_double(b: io.BytesIO) -> float: return struct.unpack("d", b.read(8))[0] def read_float(b: io.BytesIO) ‑> float-
Expand source code
def read_float(b: io.BytesIO) -> float: return struct.unpack("f", b.read(4))[0] def read_int(b: io.BytesIO) ‑> int-
Expand source code
def read_int(b: io.BytesIO) -> int: return int.from_bytes(b.read(4), "big") def read_long(b: io.BytesIO) ‑> int-
Expand source code
def read_long(b: io.BytesIO) -> int: return int.from_bytes(b.read(8), "big") def read_string(b: io.BytesIO) ‑> str-
Expand source code
def read_string(b: io.BytesIO) -> str: length = int.from_bytes(b.read(4), "big") return b.read(length).decode("utf-8") def recv_message(dplx: utils.aio.duplex_unix._Duplex, messages: MessagesDict) ‑> Message-
Expand source code
def recv_message( dplx: utils.aio.duplex_unix._Duplex, messages: MessagesDict ) -> Message: return _read_message(dplx.recv_bytes(), messages) def send_message(dplx: utils.aio.duplex_unix._Duplex,
msg: Message) ‑> None-
Expand source code
def send_message(dplx: utils.aio.duplex_unix._Duplex, msg: Message) -> None: dplx.send_bytes(_write_message(msg)) def write_bool(b: io.BytesIO, bi: bool) ‑> None-
Expand source code
def write_bool(b: io.BytesIO, bi: bool) -> None: b.write(bi.to_bytes(1, "big")) def write_bytes(b: io.BytesIO, buf: bytes) ‑> None-
Expand source code
def write_bytes(b: io.BytesIO, buf: bytes) -> None: b.write(len(buf).to_bytes(4, "big")) b.write(buf) def write_double(b: io.BytesIO, d: float) ‑> None-
Expand source code
def write_double(b: io.BytesIO, d: float) -> None: b.write(struct.pack("d", d)) def write_float(b: io.BytesIO, f: float) ‑> None-
Expand source code
def write_float(b: io.BytesIO, f: float) -> None: b.write(struct.pack("f", f)) def write_int(b: io.BytesIO, i: int) ‑> None-
Expand source code
def write_int(b: io.BytesIO, i: int) -> None: b.write(i.to_bytes(4, "big")) def write_long(b: io.BytesIO, long: int) ‑> None-
Expand source code
def write_long(b: io.BytesIO, long: int) -> None: b.write(long.to_bytes(8, "big")) def write_string(b: io.BytesIO, s: str) ‑> None-
Expand source code
def write_string(b: io.BytesIO, s: str) -> None: encoded = s.encode("utf-8") b.write(len(encoded).to_bytes(4, "big")) b.write(encoded)
Classes
class DataMessage (*args, **kwargs)-
Expand source code
@runtime_checkable class DataMessage(Message, Protocol): def write(self, b: io.BytesIO) -> None: ... def read(self, b: io.BytesIO) -> None: ...Base class for protocol classes.
Protocol classes are defined as::
class Proto(Protocol): def meth(self) -> int: ...Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing).
For example::
class C: def meth(self) -> int: return 0 def func(x: Proto) -> int: return x.meth() func(C()) # Passes static type checkSee PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as::
class GenProto[T](Protocol): def meth(self) -> T: ...Ancestors
- Message
- typing.Protocol
- typing.Generic
Methods
def read(self, b: io.BytesIO) ‑> None-
Expand source code
def read(self, b: io.BytesIO) -> None: ... def write(self, b: io.BytesIO) ‑> None-
Expand source code
def write(self, b: io.BytesIO) -> None: ...
class Message (*args, **kwargs)-
Expand source code
class Message(Protocol): MSG_ID: ClassVar[int]Base class for protocol classes.
Protocol classes are defined as::
class Proto(Protocol): def meth(self) -> int: ...Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing).
For example::
class C: def meth(self) -> int: return 0 def func(x: Proto) -> int: return x.meth() func(C()) # Passes static type checkSee PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as::
class GenProto[T](Protocol): def meth(self) -> T: ...Ancestors
- typing.Protocol
- typing.Generic
Subclasses
Class variables
var MSG_ID : ClassVar[int]