Phpcraft
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Phpcraft\Packet\KeepAliveRequestPacket Class Reference
Inheritance diagram for Phpcraft\Packet\KeepAliveRequestPacket:
Inheritance graph
[legend]
Collaboration diagram for Phpcraft\Packet\KeepAliveRequestPacket:
Collaboration graph
[legend]

Public Member Functions

 __construct ($keepAliveId=null)
 
 send (Connection $con)
 
 getResponse ()
 
 __toString ()
 

Static Public Member Functions

static read (Connection $con)
 

Public Attributes

 $keepAliveId
 

Detailed Description

Sent by the server to the client to make sure it's still connected.

Constructor & Destructor Documentation

◆ __construct()

Phpcraft\Packet\KeepAliveRequestPacket::__construct (   $keepAliveId = null)
Parameters
GMP | string | integer$keepAliveIdThe identifier of this keep alive packet. Defaults to current time.

Member Function Documentation

◆ __toString()

Phpcraft\Packet\KeepAliveRequestPacket::__toString ( )

Reimplemented from Phpcraft\Packet\Packet.

◆ getResponse()

Phpcraft\Packet\KeepAliveRequestPacket::getResponse ( )

Generates the response packet which the client should send.

Returns
KeepAliveResponsePacket

◆ read()

static Phpcraft\Packet\KeepAliveRequestPacket::read ( Connection  $con)
static

Initialises the packet class by reading its payload from the given Connection.

Parameters
Connection$con
Returns
KeepAliveRequestPacket
Exceptions
IOException

Reimplemented from Phpcraft\Packet\Packet.

◆ send()

Phpcraft\Packet\KeepAliveRequestPacket::send ( Connection  $con)

Adds the packet's ID and payload to the Connection's write buffer and sends it over the wire if the connection has a stream. Note that in some cases this will produce multiple Minecraft packets, therefore you should only use this on connections without a stream if you know what you're doing.

Parameters
Connection$con
Returns
void
Exceptions
IOException

Reimplemented from Phpcraft\Packet\Packet.

Member Data Documentation

◆ $keepAliveId

GMP Phpcraft\Packet\KeepAliveRequestPacket::$keepAliveId

The identifier of this keep alive packet.