Go to the latest version of this document.

# ``twisted`.`web`.`websocket`.`WebSocketServerFactory``

class documentation

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

View In Hierarchy

A `WebSocketServerFactory` is a factory for a particular kind of `WebSocketProtocol` that implements server-side websocket listeners via `WebSocketResource`.

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

def buildProtocol(self, request: `Request`) -> `_WSP`: (source)

To conform to `WebSocketServerFactory`, you must implement a `buildProtocol` method which takes a `Request` and returns a `WebSocketProtocol`.

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