+
    i`                       ^ RI Ht ^ RIt^ RIt^ RIt^ RIHtH	t	H
t
Ht ^RIHtHt ^RIHtHtHt . ROt ^ RIHt ^ RIHtHt R	RR
RRR/R R lltRR R llt ! R R4      tR#   ] d    R	RR
RRR/R R lltRR R llt L+i ; i)    )annotationsN)Any	AwaitableCallableLiteral)RequestResponse)ServerServerConnectionserveRouter)NotFound)MapRequestRedirectserver_namesslcreate_routerc               4    V ^8  d   QhRRRRRRRRR	R
RRRR/#    url_mapr   argsr   r   
str | Noner   z,ssl_module.SSLContext | Literal[True] | Noner   ztype[Router] | NonekwargsreturnAwaitable[Server] )formats   "`/home/wkmabra/.openclaw/workspace/venv/lib/python3.14/site-packages/websockets/asyncio/router.py__annotate__r    (   s`     jW jWjWjW  jW :	jW
 +jW jW 
jW    c                  aa	 Vf   RMRpVRJd	   Ve   W%R&   Vf   \         pV! WV4      o	VP                  RR4      oSf   S	P                  pM
R VV	3R llp\        S	P                  .VO5RV/VB # )	ax  
Create a WebSocket server dispatching connections to different handlers.

This feature requires the third-party library `werkzeug`_:

.. code-block:: console

    $ pip install werkzeug

.. _werkzeug: https://werkzeug.palletsprojects.com/

:func:`route` accepts the same arguments as
:func:`~websockets.sync.server.serve`, except as described below.

The first argument is a :class:`werkzeug.routing.Map` that maps URL patterns
to connection handlers. In addition to the connection, handlers receive
parameters captured in the URL as keyword arguments.

Here's an example::


    from websockets.asyncio.router import route
    from werkzeug.routing import Map, Rule

    async def channel_handler(websocket, channel_id):
        ...

    url_map = Map([
        Rule("/channel/<uuid:channel_id>", endpoint=channel_handler),
        ...
    ])

    # set this future to exit the server
    stop = asyncio.get_running_loop().create_future()

    async with route(url_map, ...) as server:
        await stop


Refer to the documentation of :mod:`werkzeug.routing` for details.

If you define redirects with ``Rule(..., redirect_to=...)`` in the URL map,
when the server runs behind a reverse proxy that modifies the ``Host``
header or terminates TLS, you need additional configuration:

* Set ``server_name`` to the name of the server as seen by clients. When
  not provided, websockets uses the value of the ``Host`` header.

* Set ``ssl=True`` to generate ``wss://`` URIs without enabling TLS.
  Under the hood, this bind the URL map with a ``url_scheme`` of
  ``wss://`` instead of ``ws://``.

There is no need to specify ``websocket=True`` in each rule. It is added
automatically.

Args:
    url_map: Mapping of URL patterns to connection handlers.
    server_name: Name of the server as seen by clients. If :obj:`None`,
        websockets uses the value of the ``Host`` header.
    ssl: Configuration for enabling TLS on the connection. Set it to
        :obj:`True` if a reverse proxy terminates TLS connections.
    create_router: Factory for the :class:`Router` dispatching requests to
        handlers. Set it to a wrapper or a subclass to customize routing.

NwswssTr   process_requestc               $    V ^8  d   QhRRRRRR/# r   
connectionr   requestr   r   zResponse | Noner   )r   s   "r   r    route.<locals>.__annotate__   s)     A A,A7>A Ar!   c                   <"   S! W4      p\        V\        4      '       d   VG R j  xL
 pVe   V# SP                  W4      #  L5iN)
isinstancer   route_request)r(   r)   response_process_requestrouters   && r   r%   route.<locals>.process_request   sG      ,J@h	22%-~H'#O++J@@  .s   $AAA)r   popr.   r   handler)
r   r   r   r   r   r   
url_schemer%   r0   r1   s
   &$$$*,  @@r   router6   (   s    R ![Te
d?s5M "MwZ@ JJ($/ 	 # $$ A A V^^VdVOVvVVr!   c               (    V ^8  d   QhRRRRRRRR/# 	r   r   r   pathr   r   r   r   r   r   )r   s   "r   r    r       s0     > >>> > 
	>r!   c                "    \        V 3RRRV/VB # )a2  
Create a WebSocket Unix server dispatching connections to different handlers.

:func:`unix_route` combines the behaviors of :func:`route` and
:func:`~websockets.asyncio.server.unix_serve`.

Args:
    url_map: Mapping of URL patterns to connection handlers.
    path: File system path to the Unix socket.

unixTr9   )r6   r   r9   r   s   &&,r   
unix_router=      s      W=4=d=f==r!   c               4    V ^8  d   QhRRRRRRRRR	R
RRRR/# r   r   )r   s   "r   r    r       sN     7 777  7 :	7
 +7 7 
7r!   c                   \        R 4      h)zroute() requires werkzeugImportError)r   r   r   r   r   r   s   &$$$*,r   r6   r6      s     566r!   c               (    V ^8  d   QhRRRRRRRR/# r8   r   )r   s   "r   r    r       s0     < <<< < 
	<r!   c                    \        R 4      h)zunix_route() requires werkzeugr@   r<   s   &&,r   r=   r=      s    
 :;;r!   c                  f    ] tR t^tRtRR R lltR R ltR R ltR	 R
 ltR R lt	R R lt
RtR# )r   z*WebSocket router supporting :func:`route`.Nc               (    V ^8  d   QhRRRRRRRR/# )	r   r   r   r   r   r5   strr   Noner   )r   s   "r   r    Router.__annotate__   s2     
" 
"
"  
" 	
"
 

"r!   c                	z    Wn         W n        W0n        V P                   P                  4        F
  pR Vn        K  	  R# )TN)r   r   r5   
iter_rules	websocket)selfr   r   r5   rules   &&&& r   __init__Router.__init__   s2     &$LL++-D!DN .r!   c               $    V ^8  d   QhRRRRRR/# )r   r(   r   r)   r   r   rF   r   )r   s   "r   r    rH      s#     $ $*: $W $QT $r!   c                	\    V P                   f   VP                  R,          # V P                   # )NHost)r   headers)rL   r(   r)   s   &&&r   get_server_nameRouter.get_server_name   s)    #??6**###r!   c               $    V ^8  d   QhRRRRRR/# )r   r(   r   urlrF   r   r	   r   )r   s   "r   r    rH      s"      #3 # ( r!   c                	|    VP                  \        P                  P                  R V 24      pW#P                  R&   V# )z	Found at Location)respondhttp
HTTPStatusFOUNDrS   )rL   r(   rW   r/   s   &&& r   redirectRouter.redirect   s8    %%doo&;&;y=NO'*$r!   c                    V ^8  d   QhRRRR/# )r   r(   r   r   r	   r   )r   s   "r   r    rH      s     J J$4 J Jr!   c                	V    VP                  \        P                  P                  R 4      # )z	Not Found)rZ   r[   r\   	NOT_FOUNDrL   r(   s   &&r   	not_foundRouter.not_found   s    !!$//";";[IIr!   c               $    V ^8  d   QhRRRRRR/# r'   r   )r   s   "r   r    rH      s$      *5<	r!   c                   V P                   P                  V P                  W4      V P                  R7      p \        P
                  P                  VP                  4      pVP                  VP                  VP                  R7      w  rVYVuTn        Tn        R#   \         d&   pT P                  YP                  4      u Rp?# Rp?i\         d    T P                  T4      u # i ; i)zRoute incoming request.)r   r5   )	path_info
query_argsN)r   bindrT   r5   urllibparseurlparser9   matchqueryr   r^   new_urlr   rd   r4   handler_kwargs)rL   r(   r)   url_map_adapterparsedr4   r   r^   s   &&&     r   r.   Router.route_request   s     ,,++,,ZA , 
		.\\**7<<8F-33 ++!<< 4 OG 9@5
J5  	?==-=-=>> 	.>>*--	.s*   AB C'%C?C'C'C'&C'c                    V ^8  d   QhRRRR/# )r   r(   r   r   rG   r   )r   s   "r   r    rH      s     Q Q(8 QT Qr!   c                X   "   VP                   ! V3/ VP                  B G Rj  xL
 #  L5i)zHandle a connection.N)r4   rq   rc   s   &&r   r4   Router.handler   s'     ''
Pj6O6OPPPPs   !*(*)r   r   r5   )Nr#   )__name__
__module____qualname____firstlineno____doc__rN   rT   r^   rd   r.   r4   __static_attributes__r   r!   r   r   r      s+    4
"$
J*Q Qr!   )r6   r=   r   r,   )
__future__r   r[   r   
ssl_moduleurllib.parserk   typingr   r   r   r   http11r   r	   serverr
   r   r   __all__werkzeug.exceptionsr   werkzeug.routingr   r   r6   r=   rA   r   r   r!   r   <module>r      s    "    4 4 & 3 3 ,U>,5.jW #'jW =A	jW
 .2jWX>&4Q 4Qi  <7 #'7 =A	7
 .27< <<s   A& &BB