Server
class Server
Methods
Create a new server instance.
Ensure the server is within the connection limit.
Ensure the connection is within the message rate limit.
Details
at line 32
__construct(ChannelManager $channels, EventHandler $handler, Limiter $messageRateLimiter)
Create a new server instance.
at line 42
void
open(Connection $connection)
Handle a client connection.
at line 90
void
message(Connection $from, string $message)
Handle a new message received by the connected client.
at line 166
void
control(Connection $from, int $opcode)
Handle a low-level WebSocket control frame.
at line 184
void
close(Connection $connection)
Handle a client disconnection.
Called from WebSocketHandler::onClose() when the client has already disconnected. Only cleans up Reverb state — does NOT try to close the connection again (the fd is already gone).
at line 237
void
error(Connection $connection, Throwable $exception)
Handle an error.
at line 261
protected void
ensureWithinConnectionLimit(Connection $connection)
Ensure the server is within the connection limit.
Uses SharedState for global connection counting across workers.
at line 282
protected void
ensureWithinRateLimit(Connection $connection)
Ensure the connection is within the message rate limit.
at line 298
protected Limit
messageLimit(Connection $connection)
Build the message limit for a connection.
at line 309
protected void
verifyOrigin(Connection $connection)
Verify the origin of the connection.