ack emits should allow custom types
This commit is contained in:
parent
dd2167a09f
commit
7d8eb6ffc7
@ -48,11 +48,18 @@ public final class SocketAckEmitter : NSObject {
|
||||
|
||||
/// Call to ack receiving this event.
|
||||
///
|
||||
/// If an error occurs trying to transform `items` into their socket representation, a `SocketClientEvent.error`
|
||||
/// will be emitted. The structure of the error data is `[ackNum, items, theError]`
|
||||
///
|
||||
/// - parameter items: A variable number of items to send when acking.
|
||||
public func with(_ items: SocketData...) {
|
||||
guard ackNum != -1 else { return }
|
||||
|
||||
socket.emitAck(ackNum, with: items)
|
||||
do {
|
||||
socket.emitAck(ackNum, with: try items.map({ try $0.socketRepresentation() }))
|
||||
} catch let err {
|
||||
socket.handleClientEvent(.error, data: [ackNum, items, err])
|
||||
}
|
||||
}
|
||||
|
||||
/// Call to ack receiving this event.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user