Back to Socket Io Client Swift

OnAckCallback

docs/Classes/OnAckCallback.html

16.1.1988 B
Original Source

OnAckCallback

public final class OnAckCallback : NSObject

A class that represents an emit that will request an ack that has not yet been sent. Call timingOut(after:callback:) to complete the emit Example:

socket.emitWithAck("myEvent").timingOut(after: 1) {data in
    ...
}

Methods

`

                timingOut(after:callback:)
                `

Completes an emitWithAck. If this isn’t called, the emit never happens.

Declaration

Swift

@objc
public func timingOut(after seconds: Double, callback: @escaping AckCallback)

Parameters

| seconds |

The number of seconds before this emit times out if an ack hasn’t been received.

| | callback |

The callback called when an ack is received, or when a timeout happens. To check for timeout, use SocketAckStatus‘s noAck case.

|