| 344 | create_connection = ClientConnection |
| 345 | |
| 346 | def protocol_factory(uri: WebSocketURI) -> ClientConnection: |
| 347 | # This is a protocol in the Sans-I/O implementation of websockets. |
| 348 | protocol = ClientProtocol( |
| 349 | uri, |
| 350 | origin=origin, |
| 351 | extensions=extensions, |
| 352 | subprotocols=subprotocols, |
| 353 | max_size=max_size, |
| 354 | logger=logger, |
| 355 | ) |
| 356 | # This is a connection in websockets and a protocol in asyncio. |
| 357 | connection = create_connection( |
| 358 | protocol, |
| 359 | ping_interval=ping_interval, |
| 360 | ping_timeout=ping_timeout, |
| 361 | close_timeout=close_timeout, |
| 362 | max_queue=max_queue, |
| 363 | write_limit=write_limit, |
| 364 | ) |
| 365 | return connection |
| 366 | |
| 367 | self.proxy = proxy |
| 368 | self.protocol_factory = protocol_factory |