class documentation

class WebSocketTransport(typing.Protocol): (source)

View In Hierarchy

The transport that can send websocket messages.

Method attachProducer Attach the given IPushProducer to this transport.
Method detachProducer Detach a previously attached IPushProducer from this transport.
Method loseConnection Drop the websocket connection.
Method ping Send a websocket Ping request to measure latency.
Method sendBytesMessage Send a bytes message.
Method sendTextMessage Send a text message.
def attachProducer(self, producer: IPushProducer): (source)

Attach the given IPushProducer to this transport.

def detachProducer(self): (source)

Detach a previously attached IPushProducer from this transport.

def loseConnection(self, code: int = 1000): (source)

Drop the websocket connection.

def ping(self, payload: bytes = b''): (source)

Send a websocket Ping request to measure latency.

Note
Per Mozilla's documentation, multiple 'ping' requests may be coalesced into a single 'pong', and unsolicited 'pong' requests must be ignored, so we do not return a deferred here; pongs are delivered separately.
def sendBytesMessage(self, data: bytes): (source)

Send a bytes message.

def sendTextMessage(self, text: str): (source)

Send a text message.