+
    Dfjv@                       R t ^ RIHt ^ RIt^ RIHtHt ^ RIHt ^ RIH	t	H
t
HtHt ^ RIHt ^ RIHt ^ RIHtHtHt ^ R	IHt ^ R
IHtHtHtHtHtHtHtHtH t!H"t" ^ RI#H$t$ ^ RI%H&t& ^ RI'H(t( ^ RI)H*t*H+t+H,t,H-t-H.t. ^ RI/H0t1 ^ RI2H3t3 ^ RI4H5t5 ^ RI6H7t7 ^ RI8H9t9H:t:H;t;H<t< ^ RI=H>t> ^ RI?H@t@HAtA ^ RIBHCtC ^ RIDHEtEH t   ! R R]P                  4      tG] ! R R]H4      4       tI ! R R]P                  4      tJ]! RR]JR 7      tK]	]]]3,          ]..R3,          tL]3! 4       tM ! R! R"]P                  ]K,          4      tN ! R# R$]P                  ]K,          4      tO]! RR%7       ! R& R'4      4       tP]R( R) l4       tQ]! ]+4      ] ! R* R+]
]K,          4      4       4       tR]R]J,          tS]QP                  R, R- l4       tU]QP                  R. R/ l4       tV]QP                  R0 R1 l4       tW]QP                  R2 R3 l4       tX]QP                  R4 R5 l4       tY]QP                  R6 R7 l4       tZ]QP                  R8 R9 l4       t[]QP                  R: R; l4       t\R< R= lt] ! R> R?]C4      t^R@ RA lt_R# )BzD
Private implementation module for public L{twisted.web.websocket}.
)annotationsN)	dataclassfield)singledispatch)CallableGenericTypeVarUnion)implementer)URL)
ConnectionConnectionTypeWSConnection)ConnectionState)
AcceptConnectionBytesMessageCloseConnectionEventPingPongRejectConnection
RejectDataRequestTextMessage)H11Handshake)RemoteProtocolError)Deferred)	IConsumer	IProtocolIPushProducerIReactorTCP
ITransport)Factory)Logger)Failure)BAD_REQUEST)URIBrowserLikePolicyForHTTPSResponse_StandardEndpointFactory)Headers)IAgentEndpointFactoryIPolicyForHTTPS)Resource)NOT_DONE_YETr   c                  j    ] tR t^<tRtR R ltR R ltRR R lltRR R	 lltR
 R lt	R R lt
RtR# )WebSocketTransportz1
The transport that can send websocket messages.
c                    V ^8  d   QhRRRR/#    textstrreturnNone )formats   "=/usr/lib/python3/dist-packages/twisted/web/_websocket_impl.py__annotate__WebSocketTransport.__annotate__A   s      C D     c                    R# )z
Send a text message.
Nr8   )selfr4   s   &&r:   sendTextMessage"WebSocketTransport.sendTextMessageA       r=   c                    V ^8  d   QhRRRR/# r3   databytesr6   r7   r8   )r9   s   "r:   r;   r<   F   s      U t r=   c                    R# )z
Send a bytes message.
Nr8   r?   rE   s   &&r:   sendBytesMessage#WebSocketTransport.sendBytesMessageF   rB   r=   c                    V ^8  d   QhRRRR/# )r3   codeintr6   r7   r8   )r9   s   "r:   r;   r<   K   s      3 $ r=   c                    R# )z 
Drop the websocket connection.
Nr8   )r?   rL   s   &&r:   loseConnection!WebSocketTransport.loseConnectionK   rB   r=   c                    V ^8  d   QhRRRR/# r3   payloadrF   r6   r7   r8   )r9   s   "r:   r;   r<   P   s     
 
E 
D 
r=   c                    R# )a  
Send a websocket Ping request to measure latency.

@note: Per U{Mozilla's documentation
    <https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers#pings_and_pongs_the_heartbeat_of_websockets>},
    multiple 'ping' requests may be coalesced into a single 'pong', and
    unsolicited 'pong' requests must be ignored, so we do not return a
    L{deferred <twisted.internet.defer.Deferred>} here; pongs are
    delivered separately.
Nr8   r?   rS   s   &&r:   pingWebSocketTransport.pingP   rB   r=   c                    V ^8  d   QhRRRR/# r3   producerr   r6   r7   r8   )r9   s   "r:   r;   r<   \   s      }  r=   c                    R# )z6
Attach the given L{IPushProducer} to this transport.
Nr8   r?   rZ   s   &&r:   attachProducer!WebSocketTransport.attachProducer\   rB   r=   c                   V ^8  d   QhRR/# r3   r6   r7   r8   )r9   s   "r:   r;   r<   a   s       r=   c                    R# )zD
Detach a previously attached L{IPushProducer} from this transport.
Nr8   r?   s   &r:   detachProducer!WebSocketTransport.detachProducera   rB   r=   r8   N)  r=   )__name__
__module____qualname____firstlineno____doc__r@   rI   rO   rV   r]   rc   __static_attributes__r8   r=   r:   r0   r0   <   s*    




 r=   r0   c                  &    ] tR t^gt$ RtR]R&   RtR# )ConnectionRejectedz{
A websocket connection was rejected by an HTTP response.

@ivar response: The HTTP response that describes the rejection.
r(   responser8   N)rg   rh   ri   rj   rk   __annotations__rl   r8   r=   r:   rn   rn   g   s     r=   rn   c                  b    ] tR t^rtRtR R 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# )WebSocketProtocola+  
An object that conforms to L{WebSocketProtocol} can receive all the events
from a websocket connection.

@note: While this is I{sort of} like a L{byte-stream protocol
    <twisted.internet.interfaces.IProtocol>}, the interface is distinct in
    a few ways; in particular, we have discrete C{negotiationStarted} and
    C{negotiationFinished} methods, representing those events in the
    websocket handshaking process, and no C{connectionMade}; similarly,
    since websockets can natively support both text and bytes messages,
    rather than fragmentable segments of a byte stream, we have
    C{textMessageReceived} and C{bytesMessageReceived} but no
    C{dataReceived}.  Finally, this is a L{typing.Protocol} and not a
    L{zope.interface.Interface}, since it does not predate the L{typing}
    module.
c                    V ^8  d   QhRRRR/# )r3   	transportr0   r6   r7   r8   )r9   s   "r:   r;   WebSocketProtocol.__annotate__   s      ,> 4 r=   c                    R# )zz
An underlying transport (e.g.: a TCP connection) has been established;
negotiation of the websocket transport has begun.
Nr8   r?   rt   s   &&r:   negotiationStarted$WebSocketProtocol.negotiationStarted   rB   r=   c                   V ^8  d   QhRR/# r`   r8   )r9   s   "r:   r;   ru      s      T r=   c                    R# )zV
Negotiation is complete: a bidirectional websocket channel is now fully
established.
Nr8   rb   s   &r:   negotiationFinished%WebSocketProtocol.negotiationFinished   rB   r=   c                    V ^8  d   QhRRRR/# rR   r8   )r9   s   "r:   r;   ru      s      E d r=   c                    R# )a(  
A Pong message was received.

@note: Per U{the standard
    <https://www.rfc-editor.org/rfc/rfc6455#section-5.5.2>}::

        A Pong frame sent in response to a Ping frame must have identical
        "Application data" as found in the message body of the Ping frame
        being replied to.

        If an endpoint receives a Ping frame and has not yet sent Pong
        frame(s) in response to previous Ping frame(s), the endpoint MAY
        elect to send a Pong frame for only the most recently processed
        Ping frame.

    Given that some Pong frames may be dropped, this event should only
    be used in concert with the transport's L{.ping
    <WebSocketTransport.ping>} method for its intended purpose, to
    measure latency and connection durability, not to transport
    application data.
Nr8   rU   s   &&r:   pongReceivedWebSocketProtocol.pongReceived   rB   r=   c                    V ^8  d   QhRRRR/# )r3   messager5   r6   r7   r8   )r9   s   "r:   r;   ru      s      3 4 r=   c                    R# )z,
A text message was received from the peer.
Nr8   )r?   r   s   &&r:   textMessageReceived%WebSocketProtocol.textMessageReceived   rB   r=   c                    V ^8  d   QhRRRR/# rD   r8   )r9   s   "r:   r;   ru      s       4 r=   c                    R# )z-
A bytes message was received from the peer.
Nr8   rH   s   &&r:   bytesMessageReceived&WebSocketProtocol.bytesMessageReceived   rB   r=   c                    V ^8  d   QhRRRR/# r3   reasonr$   r6   r7   r8   )r9   s   "r:   r;   ru      s      W  r=   c                    R# )z$
The websocket connection was lost.
Nr8   r?   r   s   &&r:   connectionLost WebSocketProtocol.connectionLost   rB   r=   r8   N)rg   rh   ri   rj   rk   rx   r|   r   r   r   r   rl   r8   r=   r:   rr   rr   r   s*    ".

 r=   rr   _WSPT)	covariantboundc                  &    ] tR t^tRtR R ltRtR# )WebSocketServerFactoryz
A L{WebSocketServerFactory} is a factory for a particular kind of
L{WebSocketProtocol} that implements server-side websocket listeners via
L{WebSocketResource}.
c                    V ^8  d   QhRRRR/# )r3   requestr   r6   r   r8   )r9   s   "r:   r;   #WebSocketServerFactory.__annotate__   s      W  r=   c                    R# )z
To conform to L{WebSocketServerFactory}, you must implement a
C{buildProtocol} method which takes a L{Request
<twisted.web.server.Request>} and returns a L{WebSocketProtocol}.

@return: a L{WebSocketProtocol} that will handle the inbound
    connection.
Nr8   )r?   r   s   &&r:   buildProtocol$WebSocketServerFactory.buildProtocol   rB   r=   r8   Nrg   rh   ri   rj   rk   r   rl   r8   r=   r:   r   r           r=   r   c                  &    ] tR t^tRtR R ltRtR# )WebSocketClientFactoryz
A L{WebSocketClientFactory} is a factory for a particular kind of
L{WebSocketProtocol} that implements client-side websocket listeners via
L{WebSocketClientEndpoint}.
c                    V ^8  d   QhRRRR/# )r3   urlr5   r6   r   r8   )r9   s   "r:   r;   #WebSocketClientFactory.__annotate__   s        r=   c                    R# )z
To conform to L{WebSocketServerFactory}, you must implement a
C{buildProtocol} method which takes a string representing an URL and
returns a L{WebSocketProtocol}.

@return: a L{WebSocketProtocol} that will handle the outgoing
    connection.
Nr8   )r?   r   s   &&r:   r   $WebSocketClientFactory.buildProtocol   rB   r=   r8   Nr   r8   r=   r:   r   r      r   r=   r   )frozenc                  j    ] tR t^t$ RtR]R&    R]R&    ]]! 4       RR3R R ll4       tR	 R
 lt	Rt
R# )WebSocketClientEndpointz
A L{WebSocketClientEndpoint} describes an URL to connect to and a way of
connecting to that URL, that can connect a L{WebSocketClientFactory} to
that URL.
r+   endpointFactoryr5   r   Nc               0    V ^8  d   QhRRRRRRRRR	R
RR/# )r3   reactorr    r   r5   	tlsPolicyr,   connectTimeoutz
int | NonebindAddresszbytes | Noner6   r   r8   )r9   s   "r:   r;   $WebSocketClientEndpoint.__annotate__   sF     = == = #	=
 #= "= 
!=r=   c                0    \        WWE4      p\        Wb4      # )a  
Construct a L{WebSocketClientEndpoint} from a reactor and a URL.

@param reactor: The reactor to use for the TCP connection.

@param url: a string describing an URL where a websocket server lives.

@param tlsPolicy: The TLS policy to use for HTTPS connections.

@param connectTimeout: The number of seconds for the TCP-level
    connection timeout.

@param bindAddress: The bind address to use for the TCP client
    connections.

@return: the newly constructed endpoint.
)r)   r   )clsr   r   r   r   r   r   s   &&&&&& r:   newWebSocketClientEndpoint.new   s     4 3
 '<<r=   c                    V ^8  d   QhRRRR/# )r3   protocolFactoryzWebSocketClientFactory[_WSP]r6   r   r8   )r9   s   "r:   r;   r     s     % %-I %d %r=   c                H  a aa"   S P                   P                  \        P                  ! S P                  P                  R4      4      4      pR V 3R lloVP                  \        P                  ! VVV 3R l4      4      G Rj  xL
 pVP                  G Rj  xL
 #  L L5i)a-  
Make an outgoing connection to this L{WebSocketClientEndpoint}'s HTTPS
connection.

@param protocolFactory: The constructor for the protocol.

@return: A coroutine (that yields L{Deferred}s) that completes with the
    connected L{WebSocketProtocol} once the websocket connection is
    established.
zutf-8c               $    V ^8  d   QhRRRRRR/# r3   wscWSConnection | Connectiontr!   r6   r7   r8   )r9   s   "r:   r;   5WebSocketClientEndpoint.connect.<locals>.__annotate__   s"     	9 	9!: 	9z 	9d 	9r=   c                   < \         P                  ! SP                  4      p\        VP	                  R R RR7      4      pVP                  V P                  \        VP                  V4      4      4       R# ) N)schemehostport)	r   fromTextr   r5   replacewritesend	WSRequestr   )r   r   htargetr?   s   &&  r:   clientBootstrap8WebSocketClientEndpoint.connect.<locals>.clientBootstrap   sN    TXX&A"2DABFGGCHHYqvvv678r=   c                 ~   < \        \        \        P                  4      S SP	                  SP
                  4      4      # N)_WebSocketWireProtocolr   r   CLIENTr   r   )r   r   r?   s   r:   <lambda>1WebSocketClientEndpoint.connect.<locals>.<lambda>'  s.    . !6!67##11$((;r=   N)
r   endpointForURIr&   	fromBytesr   encodeconnectProtocolFactoryforProtocol_done)r?   r   endpoint	connectedr   s   ff  @r:   r   WebSocketClientEndpoint.connect  s      ''66MM$((//'23
	9 	9
 9A8H8H''9
 3
	 __$$3
 %s$   B B"BB"B B" B"r8   )rg   rh   ri   rj   rk   rp   classmethodr'   r   r   rl   r8   r=   r:   r   r      sL     +* 
H 
 &?%@%)$(= =<% %r=   r   c               $    V ^8  d   QhRRRRRR/# )r3   eventr   protoAnyWSWPr6   r7   r8   )r9   s   "r:   r;   r;   2  s!       g $ r=   c                    R# )z$
Handle a websocket protocol event.
Nr8   r   r   s   &&r:   _handleEventr   1  rB   r=   c                     ] tR tRt$ R]R&   R]R&   R]R&   ]! RR	7      tR
]R&   ]! RR	7      tR]R&   RtR]R&   R R lt	R R lt
R R ltR R ltR R ltR R ltR*R R lltR+R R  lltR! R" ltR# R$ ltR% R& ltR' R( ltR)tR# ),r   i8  r   _wsconn
_Bootstrap
_bootstrapr   _wspF)initr!   rt   zDeferred[_WSP]r   NzResponse | None_rejectResponsec                    V ^8  d   QhRRRR/# )r3   rt   r!   r6   r7   r8   )r9   s   "r:   r;   #_WebSocketWireProtocol.__annotate__G  s      
 t r=   c                	P    Wn         \        4       V n        V P                  4        R # r   )rt   r   r   connectionMaderw   s   &&r:   makeConnection%_WebSocketWireProtocol.makeConnectionG  s    "Z
r=   c                   V ^8  d   QhRR/# r`   r8   )r9   s   "r:   r;   r   L  s     6 6 6r=   c                	    V P                   P                  V 4       V P                  V P                  V P                  4       R # r   )r   rx   r   r   rt   rb   s   &r:   r   %_WebSocketWireProtocol.connectionMadeL  s*    		$$T*dnn5r=   c                    V ^8  d   QhRRRR/# rD   r8   )r9   s   "r:   r;   r   Q  s     & & &4 &r=   c                	    V P                   P                  V4       V P                   P                  4        F  p\        W 4       K  	  R # r   )r   receive_dataeventsr   )r?   rE   r   s   && r:   dataReceived#_WebSocketWireProtocol.dataReceivedQ  s3    !!$'\\((*E% +r=   c                    V ^8  d   QhRRRR/# r   r8   )r9   s   "r:   r;   r   V  s     ( (W ( (r=   c                	    V P                   P                  V4       V P                  e%   V P                  P                  V4       R V n        R # R # r   )r   r   r   _bodyDataFinishedr   s   &&r:   r   %_WebSocketWireProtocol.connectionLostV  sA    		  (+  226:#'D  ,r=   c                    V ^8  d   QhRRRR/# r2   r8   )r9   s   "r:   r;   r   ]  s     6 6C 6D 6r=   c                	    V P                   pVf   Q hVP                  V P                  P                  \	        V4      4      4       R # r   )rt   r   r   r   r   )r?   r4   r   s   && r:   r@   &_WebSocketWireProtocol.sendTextMessage]  s5    NN}}	!!+d"345r=   c                    V ^8  d   QhRRRR/# rD   r8   )r9   s   "r:   r;   r   b  s     7 7U 7t 7r=   c                	    V P                   pVf   Q hVP                  V P                  P                  \	        V4      4      4       R # r   )rt   r   r   r   r   )r?   rE   r   s   && r:   rI   '_WebSocketWireProtocol.sendBytesMessageb  s5    NN}}	!!,t"456r=   c                    V ^8  d   QhRRRR/# rR   r8   )r9   s   "r:   r;   r   g  s     2 2E 2D 2r=   c                	    V P                   pVf   Q hVP                  V P                  P                  \	        V4      4      4       R # r   )rt   r   r   r   r   )r?   rS   r   s   && r:   rV   _WebSocketWireProtocol.pingg  s4    NN}}	!!$w-01r=   c               $    V ^8  d   QhRRRRRR/# )r3   rL   rM   r   r5   r6   r7   r8   )r9   s   "r:   r;   r   l  s!      3 s D r=   c                	    V P                   pVf   Q hVP                  V P                  P                  \	        W4      4      4       VP                  4        R # r   )rt   r   r   r   r   rO   )r?   rL   r   r   s   &&& r:   rO   %_WebSocketWireProtocol.loseConnectionl  sA    NN}}	!!/$"?@A	r=   c                    V ^8  d   QhRRRR/# rY   r8   )r9   s   "r:   r;   r   r  s     C C} C Cr=   c                	P    \        V P                  4      P                  VR 4       R# )TN)r   rt   registerProducerr\   s   &&r:   r]   %_WebSocketWireProtocol.attachProducerr  s    $..!228TBr=   c                   V ^8  d   QhRR/# r`   r8   )r9   s   "r:   r;   r   u  s     7 7 7r=   c                	L    \        V P                  4      P                  4        R # r   )r   rt   unregisterProducerrb   s   &r:   rc   %_WebSocketWireProtocol.detachProduceru  s    $..!446r=   c                   V ^8  d   QhRR/# r`   r8   )r9   s   "r:   r;   r   x  s     ( (T (r=   c                	    V P                   pV = VP                  V P                  4       V P                  P                  4        R # r   )r   callbackr   r|   r?   dones   & r:   _completeConnection*_WebSocketWireProtocol._completeConnectionx  s0    zzJdii 		%%'r=   c                   V ^8  d   QhRR/# r`   r8   )r9   s   "r:   r;   r   ~  s     ? ?4 ?r=   c                	    V P                   f   Q hV P                  pV =VP                  \        V P                   4      4       R # r   )r   r   errbackrn   r  s   & r:   _rejectConnection(_WebSocketWireProtocol._rejectConnection~  s:    ##///zzJ'(<(<=>r=   )r   r   rt   rf   )re   r   )rg   rh   ri   rj   rp   r   rt   r   r   r   r   r   r   r@   rI   rV   rO   r]   rc   r  r  rl   r8   r=   r:   r   r   8  s     '&
J "u-Iz- "u-E>-'+O_+
6
&
(6
7
2
C7(? ?r=   r   c               $    V ^8  d   QhRRRRRR/# )r3   r   r   r   r   r6   r7   r8   )r9   s   "r:   r;   r;     s"        $4  W    r=   c                &    VP                  4        R # r   )r  r   s   &&r:   _handle_acceptConnectionr    s    	r=   c               $    V ^8  d   QhRRRRRR/# )r3   r   r   r   r   r6   r7   r8   )r9   s   "r:   r;   r;     s"      $4 W  r=   c                    \        4       pV P                   F  w  r4VP                  W44       K  	  \        R V P                  RW!P
                  4      Vn        VP                  4        R# )z1.1r   N)r*   headersaddRawHeaderr(   status_codert   r   r  )r   r   hdrkvs   &&   r:   _handle_rejectConnectionr(    sP    
)C $UE,=,=r3XE	r=   c               $    V ^8  d   QhRRRRRR/# )r3   r   r   r   r   r6   r7   r8   )r9   s   "r:   r;   r;     s!     ) )j ) )T )r=   c                    VP                   f   Q R4       hVP                   P                  V P                  4       V P                  '       d   VP                  P                  4        R # R # )Nz7response should never be None when receiving RejectData)r   _bodyDataReceivedrE   body_finishedrt   rO   r   s   &&r:   _handle_rejectDatar-    s[     	)A@A)	++EJJ7&&( r=   c               $    V ^8  d   QhRRRRRR/# )r3   r   r   r   r   r6   r7   r8   )r9   s   "r:   r;   r;     s!     / /{ /7 /t /r=   c                P    VP                   P                  V P                  4       R # r   )r   r   rE   r   s   &&r:   _handle_textMessager0    s    	JJ""5::.r=   c               $    V ^8  d   QhRRRRRR/# )r3   r   r   r   r   r6   r7   r8   )r9   s   "r:   r;   r;     s!     0 0 0W 0 0r=   c                P    VP                   P                  V P                  4       R # r   )r   r   rE   r   s   &&r:   _handle_bytesMessager3    s    	JJ##EJJ/r=   c               $    V ^8  d   QhRRRRRR/# )r3   r   r   r   r   r6   r7   r8   )r9   s   "r:   r;   r;     s&     @ @ @W @ @r=   c                    VP                   P                  VP                  P                  V P	                  4       4      4       R # r   )rt   r   r   r   ro   r   s   &&r:   _handle_pingr6    s*    	OO%--,,U^^-=>?r=   c               $    V ^8  d   QhRRRRRR/# )r3   r   r   r   r   r6   r7   r8   )r9   s   "r:   r;   r;     s!     + + +W + +r=   c                P    VP                   P                  V P                  4       R # r   )r   r   rS   r   s   &&r:   _handle_pongr9    s    	JJEMM*r=   c               $    V ^8  d   QhRRRRRR/# )r3   r   r   r   r   r6   r7   r8   )r9   s   "r:   r;   r;     s!     % %? %7 %t %r=   c                0   VP                   f   Q hVP                  P                  \        P                  8w  dC   VP                   P                  VP                  P                  V P                  4       4      4       VP                   P                  4        R # r   )	rt   r   stater   CLOSEDr   r   ro   rO   r   s   &&r:   _handle_closeConnectionr>    sb    ??&&&}}o444emm001ABC	OO""$r=   c                    V ^8  d   QhRRRR/# )r3   r   r   r6   rF   r8   )r9   s   "r:   r;   r;     s     3 3w 35 3r=   c                T    V P                  \        4       V P                  R R4       R# )zcontent-typez
text/plains$   websocket protocol negotiation error)setResponseCoder%   	setHeader)r   s   &r:   _negotiationErrorrC    s#    K(nl32r=   c                  >   a  ] tR tRtRtR V 3R lltR R ltRtV ;t# )WebSocketResourcei  z
A L{WebSocketResource} is a L{Resource} that presents a websocket listener.
You can install it into any twisted web server resource hierarchy.
c                    V ^8  d   QhRRRR/# )r3   factoryz)WebSocketServerFactory[WebSocketProtocol]r6   r7   r8   )r9   s   "r:   r;   WebSocketResource.__annotate__  s     	 	 I 	d 	r=   c                0   < \         SV `  4        Wn        R# )z
Create a L{WebSocketResource} that will respond to incoming connections
with the given L{WebSocketServerFactory}.

@param factory: The factory that will be used to respond to inbound
    websocket connections on appropriately formatted GET requests.
N)super__init__rG  )r?   rG  	__class__s   &&r:   rK  WebSocketResource.__init__  s     	r=   c                    V ^8  d   QhRRRR/# )r3   r   r   r6   zbytes | intr8   )r9   s   "r:   r;   rH    s      ' k r=   c                   \        \        P                  4      pVP                  P	                  4       pV UUUu. uF  w  rEV F  qdV3NK  	  K  	  pppp VP                  WqP                  4       T P                  P                  T4      p	T	f   Q R4       hTP                  \        4       4      p
TP                  pTP                   P"                  pTf   Q R4       hTf   Q R4       h\%        T\&        T	4      pTP                   P)                  T4       TP+                  T
4       T	P-                  4        \.        # u upppi   \         d-   p\        P                  RYR7       \        T4      u Rp?# Rp?ii ; i)z^
This implementation of the C{GET} HTTP method will respond to inbound
websocket connections.
z{request} failed with {rpe})r   rpeNz"connection not accepted by twistedzchannel transport not connectedz"connection not accepted by wsproto)r   r   SERVERrequestHeadersgetAllRawHeadersinitiate_upgrade_connectionpathr   _logerrorrC  rG  r   r   r   
connectionchannelrt   r   serverBootstrap_protocolUpgradeForWebsocketsr   r|   r.   )r?   r   	handshakerawhkeyhvalsvalsimpleHeadersrP  wsprottoSendwsconr   	wireProtos   &&            r:   
render_GETWebSocketResource.render_GET  sF   
 !!6!67	$$5578;MuuM	.11-N ++G4!G#GG! 0 23$$OO%%}???} F"FF *5/6J	55i@	""$# N # 	.JJ4gJO$W--	.s#   D;E E9!E4.E94E9)rG  )	rg   rh   ri   rj   rk   rK  rf  rl   __classcell__)rL  s   @r:   rE  rE    s    
	 	 r=   rE  c               $    V ^8  d   QhRRRRRR/# r   r8   )r9   s   "r:   r;   r;     s"      2 z d r=   c                    R# )z;
The server requires no bootstrapping, so this is a no-op.
Nr8   )r   r   s   &&r:   rZ  rZ    rB   r=   )`rk   
__future__r   typingdataclassesr   r   	functoolsr   r   r   r   r	   zope.interfacer
   	hyperlinkr   wsprotor   r   r   wsproto.connectionr   wsproto.eventsr   r   r   r   r   r   r   r   r   r   r   wsproto.handshaker   wsproto.utilitiesr   twisted.internet.deferr   twisted.internet.interfacesr   r   r   r    r!   twisted.internet.protocolr"   r   twisted.loggerr#   twisted.python.failurer$   twisted.web._responsesr%   twisted.web.clientr&   r'   r(   r)   twisted.web.http_headersr*   twisted.web.iwebr+   r,   twisted.web.resourcer-   twisted.web.serverr.   Protocolr0   	Exceptionrn   rr   r   r   rV  r   r   r   r   r   r   registerr  r(  r-  r0  r3  r6  r9  r>  rC  rE  rZ  r8   r=   r:   <module>r     ss  
 #  ( $ 4 4 &  < < .   + 1 +  A ! * .  - C ) 4( (V   B BJ v->?u\:56
CTIJ
xV__T2 $V__T2 $ $M% M% M%`   Y
H?WT] H?  H?V !!2
3       ) ) / / 0 0 @ @ + + % %3) )Xr=   