Contents

sendPing(pongReceiveHandler:)

Sends a ping frame from the client side, with a closure to receive the pong from the server endpoint.

Declaration

func sendPing(pongReceiveHandler: @escaping  @Sendable ((any Error)?) -> Void)

Parameters

  • pongReceiveHandler:

    A closure called by the task when it receives the pong from the server. The block/closure receives an Nserror that indicates a lost connection or other problem, or nil if no error occurred.

Discussion

When sending multiple pings, the task always calls pongReceiveHandler in the order it sent the pings.