class_docstr: Provides a common wrapper for replicas running an ASGI app.
code: def __init__(self, app: ASGIApp):
      self._asgi_app = app
  
      # Use uvicorn's lifespan handling code to properly deal with
      # startup and shutdown event.
      self._serve_asgi_lifespan = LifespanOn(
          Config(self._asgi_app, lifespan="on")
      )
  
      # Replace uvicorn logger with our own.
      self._serve_asgi_lifespan.logger = logger
  
imports: import asyncio
  import inspect
  import json
  import logging
  import pickle
  import socket
  from dataclasses import dataclass
  from typing import Any, List, Optional, Tuple, Type
  import starlette
  from fastapi.encoders import jsonable_encoder
  from starlette.types import ASGIApp, Message, Receive, Scope, Send
  from uvicorn.config import Config
  from uvicorn.lifespan.on import LifespanOn
  from ray._private.pydantic_compat import IS_PYDANTIC_2
  from ray.actor import ActorHandle
  from ray.serve._private.constants import SERVE_LOGGER_NAME
  from ray.serve._private.utils import serve_encoders
  from ray.serve.exceptions import RayServeException
label_desc: Use image node_id 1 to create a new ASGIAppReplicaWrapper object  with example: obj = ASGIAppReplicaWrapper(app)