Binary payloads are by default translated to JSON array and rejected by the server. Example:
for i in 1...5 {
// continuation.yield([UInt8(i)] // fails
continuation.yield(Data([UInt8(i)]).base64EncodedString()) // workaround
Thread.sleep(forTimeInterval: 0.1)
}
The workaround is to base64 encode the data before sending. Similarly, receiving the data as byte array won't work. It needs to be a string which the client needs to then base64 decode.
struct MessageSHA: Decodable {
// let value: [UInt8] - doesn't work
let value: String
let shaType: Int
}