HelPHP

Protocol_exception extends Exception
in package

A WebSocket protocol error, carrying the close code the peer must receive.

RFC 6455 wants the connection closed with a precise status: 1002 for a protocol violation, 1007 for data that is not text, 1009 for a message too big, 1008 for a policy refusal. The close code is what tells the browser whether retrying makes sense, so it travels with the exception instead of being guessed by the caller.

Tags
see

Frame, Connection

Table of Contents

Methods

__construct()  : mixed
get_close_code()  : int
Close code the peer must receive before the socket is closed.

Methods

__construct()

public __construct(string $message[, int $close_code = 1002 ][, Throwable|null $previous = null ]) : mixed
Parameters
$message : string

Human readable cause, written to the log only.

$close_code : int = 1002

RFC 6455 close code for the peer.

$previous : Throwable|null = null

get_close_code()

Close code the peer must receive before the socket is closed.

public get_close_code() : int
Return values
int
On this page

Search results