Connection
class Connection extends Connection
Traits
Properties
| protected int|null | $lastSeenAt | The last time the connection was seen. |
from Connection |
| protected bool | $hasBeenPinged | Stores the ping state of the connection. |
from Connection |
| protected bool | $usesControlFrames | Indicates if the connection uses control frames. |
from Connection |
| protected bool | $established | Whether the Pusher connection handshake completed. |
from Connection |
| protected bool | $connectionSlotAcquired | Whether a connection slot was acquired for this connection. |
from Connection |
| protected bool | $rateLimiterInitialized | Whether message rate-limiter state was initialized. |
from Connection |
| protected bool | $disconnecting | Whether this connection is being cleaned up after a transport disconnect. |
from Connection |
| protected string|null | $id | The normalized socket ID. |
Methods
Create a new connection instance.
Get the raw socket connection identifier.
Get the normalized socket ID.
Send a message to the connection.
Send a control frame to the connection.
Terminate a connection.
Disconnect and unsubscribe from all channels.
Mark the connection as using control frames to track activity.
Whether a connection slot was acquired for this connection.
Mark that a connection slot was acquired for this connection.
Determine whether rate-limiter state was initialized.
Details
in
Connection at line 56
__construct(WebSocketConnection $connection, Application $application, string|null $origin)
Create a new connection instance.
at line 23
string
identifier()
Get the raw socket connection identifier.
at line 31
string
id()
Get the normalized socket ID.
at line 43
void
send(string $message)
Send a message to the connection.
at line 55
void
control(int $opcode = WEBSOCKET_OPCODE_PING)
Send a control frame to the connection.
at line 63
void
terminate(int|null $code = null, string|null $reason = null)
Terminate a connection.
in
Connection at line 92
Application
app()
Get the application the connection belongs to.
in
Connection at line 100
string|null
origin()
Get the origin of the connection.
in
Connection at line 108
void
ping()
Mark the connection as pinged.
in
Connection at line 116
void
pong()
Mark the connection as ponged.
in
Connection at line 124
int|null
lastSeenAt()
Get the last time the connection was seen.
in
Connection at line 132
Connection
setLastSeenAt(int $time)
Set the connection last seen at timestamp.
in
Connection at line 142
Connection
touch()
Touch the connection last seen at timestamp.
in
Connection at line 153
void
disconnect(int|null $code = null, string|null $reason = null)
Disconnect and unsubscribe from all channels.
in
Connection at line 161
bool
isActive()
Determine whether the connection is still active.
in
Connection at line 169
bool
isInactive()
Determine whether the connection is inactive.
in
Connection at line 177
bool
isStale()
Determine whether the connection is stale.
in
Connection at line 185
bool
usesControlFrames()
Determine whether the connection uses control frames.
in
Connection at line 193
Connection
setUsesControlFrames(bool $usesControlFrames = true)
Mark the connection as using control frames to track activity.
in
Connection at line 203
bool
isEstablished()
Determine whether the connection handshake completed.
in
Connection at line 211
void
markEstablished()
Mark the connection as established.
in
Connection at line 219
bool
hasAcquiredConnectionSlot()
Whether a connection slot was acquired for this connection.
in
Connection at line 227
void
markConnectionSlotAcquired()
Mark that a connection slot was acquired for this connection.
in
Connection at line 235
void
clearConnectionSlotAcquired()
Clear the connection slot acquired flag.
in
Connection at line 243
bool
hasInitializedRateLimiter()
Determine whether rate-limiter state was initialized.
in
Connection at line 251
void
markRateLimiterInitialized()
Mark the rate limiter as initialized.
in
Connection at line 259
void
clearRateLimiterInitialized()
Clear the rate-limiter initialized flag.
in
Connection at line 267
void
markDisconnecting()
Mark the connection as disconnecting (transport closed).
in
Connection at line 275
bool
isDisconnecting()
Determine whether the connection is disconnecting.
in
GeneratesIdentifiers at line 12
protected string
generateId()
Generate a Pusher-compatible socket ID.