Yes, I am aware of How to incorporate WebSockets into a Cocoa application, but that question is almost a year old and it is clear that the selected answer (zimt) i开发者_如何学Gos no longer an acceptable solution.
Is there any WebSocket client that is usable from within my iOS application? It can be C or Objective-C, but it has to have full support for WebSocket (Zimt doesn't handle Sec-WebSocket-Key1 and Sec-WebSocket-Key2).
You can check out the UnitT Web Socket Client. It is intended for use in iOS apps using Objective-C. However, Sec-WebSocket-Key1 & Sec-WebSocket-Key2 are part of an earlier revision of web sockets. Since version 6, the client now needs to support Sec-WebSocket-Accept. Unfortunately, not all the servers use this yet. UnitT Web Socket Client allows you turn this check on or off programmatically. In addition, it works with both ws & wss.
I am the author and have been using it in some of my projects with success. Let me know if you run into any trouble and I will do what I can to help.
Check out SocketRocket. It supports the latest standard, RFC 6455, which Unitt does not. No CocoaAsyncSocket dependencies either.
I created an Obj-C package to handle TLS taking into account the latest (iOS 13) TLS restrictions on certificates.
https://github.com/eamonwhiter73/IOSObjCWebSockets
精彩评论