+
    i                       ^ RI Ht ^ RIt^ RIt^ RIt^ RI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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returnr	    )formats   "]/home/wkmabra/.openclaw/workspace/venv/lib/python3.14/site-packages/websockets/sync/router.py__annotate__r   (   s`     dW dWdWdW  dW :	dW
 +dW dW 
d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 # )	a  
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.sync.router import route
    from werkzeug.routing import Map, Rule

    def channel_handler(websocket, channel_id):
        ...

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

    with route(url_map, ...) as server:
        server.serve_forever()

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                B   < S! W4      pVe   V# SP                  W4      # N)route_request)r&   r'   response_process_requestrouters   && r   r#   route.<locals>.process_request   s+     ,J@'#O++J@@r   )r   popr+   r   handler)
r   r   r   r   r   r   
url_schemer#   r-   r.   s
   &$$$*,  @@r   router3   (   s    J ![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 # )a/  
Create a WebSocket Unix server dispatching connections to different handlers.

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

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

unixTr6   )r3   r   r6   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   r3   r3      s     566r   c               (    V ^8  d   QhRRRRRRRR/# r5   r   )r   s   "r   r   r      s0     < <<< < 
	<r   c                    \        R 4      h)zunix_route() requires werkzeugr=   r9   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   r2   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   r2   
iter_rules	websocket)selfr   r   r2   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   rC   r   )r   s   "r   r   rE      s#     $ $*: $W $QT $r   c                	\    V P                   f   VP                  R,          # V P                   # )NHost)r   headers)rI   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
   urlrC   r   r   r   )r   s   "r   r   rE      s"      #3 # ( r   c                	|    VP                  \        P                  P                  R V 24      pW#P                  R&   V# )z	Found at Location)respondhttp
HTTPStatusFOUNDrP   )rI   r&   rT   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   rE      s     J J$4 J Jr   c                	V    VP                  \        P                  P                  R 4      # )z	Not Found)rW   rX   rY   	NOT_FOUNDrI   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   rE      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   r2   )	path_info
query_argsN)r   bindrQ   r2   urllibparseurlparser6   matchqueryr   r[   new_urlr   ra   r1   handler_kwargs)rI   r&   r'   url_map_adapterparsedr1   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   rD   r   )r   s   "r   r   rE      s     K K"2 Kt Kr   c                <    VP                   ! V3/ VP                  B # )zHandle a connection.)r1   rn   r`   s   &&r   r1   Router.handler   s    !!*J
0I0IJJr   )r   r   r2   )Nr!   )__name__
__module____qualname____firstlineno____doc__rK   rQ   r[   ra   r+   r1   __static_attributes__r   r   r   r   r      s+    4
"$
J*K Kr   )r3   r:   r   r*   )
__future__r   rX   r   
ssl_moduleurllib.parserh   typingr   r   r   http11r   r   serverr	   r
   r   __all__werkzeug.exceptionsr   werkzeug.routingr   r   r3   r:   r>   r   r   r   r   <module>r      s    "    ) ) & 3 3 ,O>,5.dW #'dW =A	dW
 .2dWL>&4K 4K]  <7 #'7 =A	7
 .27< <<s   A$ $BB