autobahn.websocket.types

Exceptions

ConnectionDeny

Throw an instance of this class to deny a WebSocket connection

Classes

ConnectingRequest

Thin-wrapper for WebSocket connection request information provided in

ConnectionAccept

Used by WebSocket servers to accept an incoming WebSocket connection.

ConnectionRequest

Thin-wrapper for WebSocket connection request information provided in

ConnectionResponse

Thin-wrapper for WebSocket connection response information provided in

IncomingMessage

An incoming WebSocket message.

Message

Abstract base class for WebSocket messages.

OutgoingMessage

An outgoing WebSocket message.

Ping

A WebSocket ping message.

Module Contents

class ConnectingRequest(host=None, port=None, resource=None, headers=None, useragent=None, origin=None, protocols=None)[source]

Bases: object

Thin-wrapper for WebSocket connection request information provided in autobahn.websocket.protocol.WebSocketClientProtocol.onConnecting() after a client has connected, but before the handshake has proceeded.

host, port, and resource are all required, everything else is optional. Note that these are values that will be seen by the client and should represent the public-facing host, port and resource to which the client is connecting (not necessarily the action host/port being used).

__json__()[source]
__slots__ = ('host', 'port', 'resource', 'headers', 'useragent', 'origin', 'protocols')[source]
__str__()[source]
headers = None[source]
host = None[source]
origin = None[source]
port = None[source]
protocols = None[source]
resource = None[source]
useragent = None[source]
class ConnectionAccept(subprotocol=None, headers=None)[source]

Bases: object

Used by WebSocket servers to accept an incoming WebSocket connection. If the client announced one or multiple subprotocols, the server MUST select one of the subprotocols announced by the client.

__slots__ = ('subprotocol', 'headers')[source]
headers = None[source]
subprotocol = None[source]
exception ConnectionDeny(code, reason=None)[source]

Bases: Exception

Throw an instance of this class to deny a WebSocket connection during handshake in autobahn.websocket.protocol.WebSocketServerProtocol.onConnect().

BAD_REQUEST = 400[source]

Bad Request. The request cannot be fulfilled due to bad syntax.

FORBIDDEN = 403[source]

Forbidden. The request was a legal request, but the server is refusing to respond to it.[2] Unlike a 401 Unauthorized response, authenticating will make no difference.

INTERNAL_SERVER_ERROR = 500[source]

Internal Server Error. A generic error message, given when no more specific message is suitable.

NOT_ACCEPTABLE = 406[source]

Not Acceptable. The requested resource is only capable of generating content not acceptable according to the Accept headers sent in the request.

NOT_FOUND = 404[source]

Not Found. The requested resource could not be found but may be available again in the future.[2] Subsequent requests by the client are permissible.

NOT_IMPLEMENTED = 501[source]

Not Implemented. The server either does not recognize the request method, or it lacks the ability to fulfill the request.

REQUEST_TIMEOUT = 408[source]

‘The client did not produce a request within the time that the server was prepared to wait. The client MAY repeat the request without modifications at any later time.

Type:

Request Timeout. The server timed out waiting for the request. According to W3 HTTP specifications

SERVICE_UNAVAILABLE = 503[source]

Service Unavailable. The server is currently unavailable (because it is overloaded or down for maintenance). Generally, this is a temporary state.

__slots__ = ('code', 'reason')[source]
code[source]
reason = None[source]
class ConnectionRequest(peer, headers, host, path, params, version, origin, protocols, extensions)[source]

Bases: object

Thin-wrapper for WebSocket connection request information provided in autobahn.websocket.protocol.WebSocketServerProtocol.onConnect() when a WebSocket client want to establish a connection to a WebSocket server.

__json__()[source]
__slots__ = ('peer', 'headers', 'host', 'path', 'params', 'version', 'origin', 'protocols', 'extensions')[source]
__str__()[source]
extensions[source]
headers[source]
host[source]
origin[source]
params[source]
path[source]
peer[source]
protocols[source]
version[source]
class ConnectionResponse(peer, headers, version, protocol, extensions)[source]

Bases: object

Thin-wrapper for WebSocket connection response information provided in autobahn.websocket.protocol.WebSocketClientProtocol.onConnect() when a WebSocket server has accepted a connection request by a client.

__json__()[source]
__slots__ = ('peer', 'headers', 'version', 'protocol', 'extensions')[source]
__str__()[source]
extensions[source]
headers[source]
peer[source]
protocol[source]
version[source]
class IncomingMessage(payload, is_binary=False)[source]

Bases: Message

An incoming WebSocket message.

__slots__ = ('payload', 'is_binary')[source]
is_binary = False[source]
payload[source]
class Message[source]

Bases: object

Abstract base class for WebSocket messages.

__slots__ = ()[source]
class OutgoingMessage(payload, is_binary=False, skip_compress=False)[source]

Bases: Message

An outgoing WebSocket message.

__slots__ = ('payload', 'is_binary', 'skip_compress')[source]
is_binary = False[source]
payload[source]
skip_compress = False[source]
class Ping(payload=None)[source]

Bases: object

A WebSocket ping message.

__slots__ = 'payload'[source]
payload = None[source]