I'm trying to upload a file from ObjectiveC to a BinaryJS server. I've tried https://github.com/square/SocketRocket with no luck. SocketRocket can't transfer byte arrays, it expects an NSData object or NSString, whereas BinaryJS is expecting an Array.
Any idea what i'm doing wrong or suggestions for a complete library?
thanks in advance!
I was just wondering the same thing and took a quick look at SocketRocket's code.
I'm not 100% sure, but I'm guessing this should work:
NSData *sendMeToSocketRocket = [NSData dataWithBytesNoCopy:byteArrayGoesHere length:sizeof(byteArrayGoesHere) freeWhenDone:YES];
In other words, your question is really "how do I convert byte arrays to NSData?", and I hope that answers it. :-)