Go to the latest version of this document.

# ``twisted`.`web`.`websocket`.`WebSocketClientFactory``

class documentation

`class WebSocketClientFactory(typing.Protocol[_WSP]): (source)`

View In Hierarchy

A `WebSocketClientFactory` is a factory for a particular kind of `WebSocketProtocol` that implements client-side websocket listeners via `WebSocketClientEndpoint`.

Method | `buildProtocol` | To conform to `WebSocketServerFactory`, you must implement a `buildProtocol` method which takes a string representing an URL and returns a `WebSocketProtocol`.

def buildProtocol(self, url: `str`) -> `_WSP`: (source)

To conform to `WebSocketServerFactory`, you must implement a `buildProtocol` method which takes a string representing an URL and returns a `WebSocketProtocol`.

Returns
`_WSP` | a `WebSocketProtocol` that will handle the outgoing connection.