Skip to content

# pamqp.heartbeat

## `pamqp.heartbeat`

AMQP Heartbeat Frame, used to create new Heartbeat frames for sending to a peer

### `Heartbeat`

Heartbeat frame object mapping class. AMQP Heartbeat frames are mapped on to this class for a common access structure to the attributes/data values.

Source code in `pamqp/heartbeat.py`

    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28

    class Heartbeat:
        """Heartbeat frame object mapping class. AMQP Heartbeat frames are mapped
        on to this class for a common access structure to the attributes/data
        values.

        """

        name: typing.ClassVar[str] = 'Heartbeat'
        value: typing.ClassVar[bytes] = (
            struct.pack('>BHI', constants.FRAME_HEARTBEAT, 0, 0)
            + constants.FRAME_END_CHAR
        )

        @classmethod
        def marshal(cls) -> bytes:
            """Return the binary frame content"""
            return cls.value

#### `marshal()` `classmethod`

Return the binary frame content

Source code in `pamqp/heartbeat.py`

    25
    26
    27
    28

    @classmethod
    def marshal(cls) -> bytes:
        """Return the binary frame content"""
        return cls.value