autobahn.websocket.types


Module Contents

Classes

ConnectionRequest

Thin-wrapper for WebSocket connection request information provided in

ConnectingRequest

Thin-wrapper for WebSocket connection request information provided in

ConnectionResponse

Thin-wrapper for WebSocket connection response information provided in

ConnectionAccept

Used by WebSocket servers to accept an incoming WebSocket connection.

Message

Abstract base class for WebSocket messages.

IncomingMessage

An incoming WebSocket message.

OutgoingMessage

An outgoing WebSocket message.

Ping

A WebSocket ping message.

class autobahn.websocket.types.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.

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

Return str(self).

class autobahn.websocket.types.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).

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

Return str(self).

class autobahn.websocket.types.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.

__slots__ = ['peer', 'headers', 'version', 'protocol', 'extensions']
__json__()[source]
__str__()[source]

Return str(self).

class autobahn.websocket.types.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']
exception autobahn.websocket.types.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().

__slots__ = ['code', 'reason']
BAD_REQUEST = 400

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

FORBIDDEN = 403

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.

NOT_FOUND = 404

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_ACCEPTABLE = 406

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

REQUEST_TIMEOUT = 408

Request Timeout. The server timed out waiting for the request. According to W3 HTTP specifications: ‘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.

INTERNAL_SERVER_ERROR = 500

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

NOT_IMPLEMENTED = 501

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

SERVICE_UNAVAILABLE = 503

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

class autobahn.websocket.types.Message[source]

Bases: object

Abstract base class for WebSocket messages.

__slots__ = []
class autobahn.websocket.types.IncomingMessage(payload, is_binary=False)[source]

Bases: Message

An incoming WebSocket message.

__slots__ = ['payload', 'is_binary']
class autobahn.websocket.types.OutgoingMessage(payload, is_binary=False, skip_compress=False)[source]

Bases: Message

An outgoing WebSocket message.

__slots__ = ['payload', 'is_binary', 'skip_compress']
class autobahn.websocket.types.Ping(payload=None)[source]

Bases: object

A WebSocket ping message.

__slots__ = payload