Issue with Telemetry Forwarding

I want to retrieve data from the Pixhawk and selectively transmit specific packets or messages to my Ground Control Station (GCS) on the other end. The code snippet I’m employing is presented below:

from pymavlink import mavutil

def mavlink_forward(source_system, destination_system, destination_port):
    source_conn = mavutil.mavlink_connection(source_system)
    destination_conn = mavutil.mavlink_connection(f"udp:{destination_system}:{destination_port}")

    print(f"Forwarding MAVLink packets from {source_system} to {destination_system}:{destination_port}")

    while True:
        message = source_conn.recv_msg()
        # required_message = source_conn.recv_match("SYS_STATUS")
        
        if message is not None:
            destination_conn.mav.send(message)

if __name__ == "__main__":
    source_system = "COM36"
    destination_system = "127.0.0.1"
    destination_port = 12345

    mavlink_forward(source_system, destination_system, destination_port)

This code operates as expected during runtime. However, when attempting to connect Mission Planner via UDP using port 12345, connectivity fails. Upon clicking the connect button in Mission Planner, I can observe data on the HUD. Movement changes from the Pixhawk are also reflected. Nevertheless, the telemetry connection dialog box persists with a timer. After 30 seconds, a message appears stating the failure to establish telemetry connection, citing the absence of heartbeat packets. It’s mentioned that two valid heartbeat packets are necessary for connection.

To address this issue, I attempted to manually send heartbeat packets using the following commands:

destination_conn.mav.heartbeat_send(mavutil.mavlink.MAV_TYPE_ONBOARD_CONTROLLER, mavutil.mavlink.MAV_AUTOPILOT_INVALID, 0, 0, 0)

destination_conn.mav.heartbeat_send(mavutil.mavlink.MAV_TYPE_GCS, mavutil.mavlink.MAV_AUTOPILOT_INVALID, 0, 0, 0)

I experimented with sending these commands both inside and outside the loop without success. Can someone provide guidance on how to successfully retrieve data on the GCS (Mission Planner or QGroundControl)?