Mint.HTTP2.ping

You're seeing just the function ping, go back to Mint.HTTP2 module for more information.
Link to this function

ping(conn, payload \\ :binary.copy(<<0>>, 8))

View Source

Specs

ping(t(), <<_::8>>) ::
  {:ok, t(), Mint.Types.request_ref()} | {:error, t(), Mint.Types.error()}

Pings the server.

This function is specific to HTTP/2 connections. It sends a ping request to the server conn is connected to. A {:ok, conn, request_ref} tuple is returned, where conn is the updated connection and request_ref is a unique reference that identifies this ping request. The response to a ping request is returned by stream/2 as a {:pong, request_ref} tuple. If there's an error, this function returns {:error, conn, reason} where conn is the updated connection and reason is the error reason.

payload must be an 8-byte binary with arbitrary content. When the server responds to a ping request, it will use that same payload. By default, the payload is an 8-byte binary with all bits set to 0.

Pinging can be used to measure the latency with the server and to ensure the connection is alive and well.

Examples

{:ok, conn, ref} = Mint.HTTP2.ping(conn)