Skip to content

miniproto.connection.framing.create_frame_codec

miniproto.connection.framing.create_frame_codec

Section titled “miniproto.connection.framing.create_frame_codec”
create_frame_codec(mode: TransportMode | str, *, max_payload_size: int, server_side: bool = False) -> TransportFrameCodec

Create the fastest available codec for one MTProto TCP framing mode.

Parameters:

  • mode (TransportMode | str) – Requested TCP transport mode.
  • max_payload_size (int) – Maximum permitted unframed MTProto payload size.
  • server_side (bool) – Whether decoding models traffic received by a server.

Returns:

Raises:

  • ValueError – If the fallback codec receives an unsupported mode or an invalid payload bound.
  • RuntimeError – If the native extension is found but cannot initialize.