Store your connected peers to a dictionary or array and remove them from said storage on disconnect or use sceneTree's get_network_connected_peers()
Then before an rpc_id
call do a verification check
if id in connected_peers:
rpc_id(id, "send_important_data", data)
Such a check would be in micro seconds an wouldn't affect performance in the slightest