ack emits should allow custom types

This commit is contained in:
Erik Little 2017-05-08 07:50:13 -04:00
parent dd2167a09f
commit 7d8eb6ffc7
No known key found for this signature in database
GPG Key ID: 62F837E56F4E9320

View File

@ -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.