remoteFramePayloadLimit function

int remoteFramePayloadLimit(
  1. FrameType? type
)

The maximum payload accepted for type by the default remote wire.

Both producers and consumers use this table. Keeping it outside FrameDecoder prevents a local producer from emitting a frame that the matching decoder is guaranteed to reject and classify as an unrecoverable loss of stream framing.

Implementation

int remoteFramePayloadLimit(FrameType? type) => switch (type) {
  FrameType.init ||
  FrameType.resize ||
  FrameType.clipboardResult ||
  FrameType.caret ||
  FrameType.semanticActionResult ||
  FrameType.debugRequest ||
  FrameType.bye => maxRemoteControlFramePayloadLength,
  FrameType.input ||
  FrameType.inputEvent ||
  FrameType.semanticAction ||
  FrameType.clipboardWrite => maxRemoteInputFramePayloadLength,
  FrameType.output ||
  FrameType.plan ||
  FrameType.semantics ||
  FrameType.debugResponse => maxRemoteDocumentFramePayloadLength,
  FrameType.inlineImage => maxRemoteImageFramePayloadLength,
  null => defaultMaxRemoteFramePayloadLength,
};