Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebSockets client for Objective-C (preferably iOS compatible)

Closest thing I've found is How to incorporate WebSockets into a Cocoa application, but the answers only pointed to an outdated library.

Does anyone know about a WebSockets library compatible with iOS 4.x?

I've also read about Pusherapp, and, as good as the service could be, I would prefer to use my own WebSockets server.

like image 223
Ian Avatar asked Dec 21 '10 15:12

Ian


People also ask

Do WebSockets work on iOS?

As you can see from the code snippets above, although the communication is done over WebSockets, the underlying WebSocket protocol is ''hidden'' from developers. You can decide to use any WebSocket-based protocol that supports iOS.

What is WebSocket iOS?

WebSocket is a communication protocol that uses sockets, providing duplex communication over a single TCP connection. It was standardized by the IETF in 2011 and is a different protocol from HTTP. WebSockets are widely used in chat apps, streaming real-time notifications, and stock prices.

What is Nsurl WebSocket?

NSURLSessionWebSocketTask is a concrete subclass of NSURLSessionTask that provides a message-oriented transport protocol over TCP and TLS in the form of WebSocket framing. It follows the WebSocket Protocol defined in RFC 6455. You create a NSURLSessionWebSocketTask with either a ws: or wss: URL.

What are WebSockets used for?

The WebSocket API is an advanced technology that makes it possible to open a two-way interactive communication session between the user's browser and a server. With this API, you can send messages to a server and receive event-driven responses without having to poll the server for a reply.


2 Answers

You can check out the UnitT Web Socket Client. It is intended for use in iOS apps using Objective-C. 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.

like image 55
Josh Morris Avatar answered Sep 28 '22 09:09

Josh Morris


Found this post in a google search for iOS WebSockets and wanted to put an updated answer.

Anyways, Zimt and Unitt's client don't support the latest standard (at the time of writing this).

(disclaimer: author of SocketRocket)

We just released a new library that has no external dependencies, supports RFC 6455 completely, and works with iOS 4.x+.

It's called SocketRocket and can be found here

like image 28
mikelikespie Avatar answered Sep 28 '22 07:09

mikelikespie