Skip to main content

WebSocketException

A WebSocket exception you can raise in your own code to show errors to the client. This is for client errors, invalid authentication, invalid data, etc. Not for server errors in your code.

Constructor

Signature

def WebSocketException(
code: int,
reason: str | None = None
) - > None

Parameters

NameTypeDescription
codeintA closing code from the valid codes defined in the specification.
reason`strNone` = None

Signature

def WebSocketException(
code: int = null,
reason: str | None = None
) - > null

Parameters

NameTypeDescription
codeint = nullA closing code from the valid codes defined in the specification.
reason`strNone` = None