
    Xj                        d Z ddlmZ ddlmZmZ ddlmZ ddlm	Z	m
Z
 ddlmZ ddlmZ erdd	lmZ  G d
 de	      ZdgZy)a  GraphQLWebSocketRouter.

This is a simple router class that might be better placed as part of Channels itself.
It's a simple "SubProtocolRouter" that selects the websocket subprotocol based
on preferences and client support. Then it hands off to the appropriate consumer.
    )annotations)TYPE_CHECKINGOptional)re_path)ProtocolTypeRouter	URLRouter   )GraphQLHTTPConsumer)GraphQLWSConsumer)
BaseSchemac                  8     e Zd ZdZ	 	 d	 	 	 	 	 	 	 d fdZ xZS )GraphQLProtocolTypeRouteray  HTTP and Websocket GraphQL type router.

    Convenience class to set up GraphQL on both HTTP and Websocket,
    optionally with a Django application for all other HTTP routes.

    ```python
    from strawberry.channels import GraphQLProtocolTypeRouter
    from django.core.asgi import get_asgi_application

    django_asgi = get_asgi_application()

    from myapi import schema

    application = GraphQLProtocolTypeRouter(
        schema,
        django_application=django_asgi,
    )
    ```

    This will route all requests to /graphql on either HTTP or websockets to us,
    and everything else to the Django application.
    c                   t        |t        j                  |            g}||j                  t        d|             t        |   t        |      t        t        |t        j                  |            g      d       y )N)schema^)http	websocket)r   r
   as_asgiappendsuper__init__r   r   )selfr   django_applicationurl_pattern	http_urls	__class__s        g/var/www/html/myl_app/scheduler-service/venv/lib/python3.12/site-packages/strawberry/channels/router.pyr   z"GraphQLProtocolTypeRouter.__init__/   sy     [*=*E*EV*TUV	)WS*<=>!),&->-F-Ff-UV		
    )Nz^graphql)r   r   r   zOptional[str]r   strreturnNone)__name__
__module____qualname____doc__r   __classcell__)r   s   @r   r   r      s@    4 -1%	

 *
 	

 

 
r   r   N)r%   
__future__r   typingr   r   django.urlsr   channels.routingr   r   handlers.http_handlerr
   handlers.ws_handlerr   strawberry.schemar   r   __all__ r   r   <module>r0      s<    # *  : 6 2,+
 2 +
\ '
'r   