Ping

Returns the ping connection to the websocket

For getting the ping, we currently use heartbeat ACK sent over the websocket connection after heartbeating.

After the first heartbeat ~41,5 seconds after start you can use the method:

Discord::getInstance()->getClient()->getPing()

This will return the rounded time in milliseconds the connection took to send and receive a packet, which is the ping. This method might be upgraded using opcodes which might follows in a further version of phpcord.

This method will return -1 if it was called before the first heartbeat!

Last updated