I’m developing some sort of massive multiplayer board-game. My solution is node.js socket.io on server. I need solution for implementation some sort of objective-c socket which would communicate with socket.io for sending and receiving json objects as string. i won't use webkit with websocket. Is there any possibility? server will hold state of game, iphone clients will sending action to server and receiving changes on server back.
-
This question is off-topic; [questions asking only for recommendations of libraries or other off-site resources are off-topic for Stack Overflow](//meta.stackoverflow.com/q/251134/2747593). OP, if you are still having this problem, then please start writing code, and come back when you have a more specific problem. Be sure to show us [what you have tried](http://whathaveyoutried.com) and include a [Minimal, Complete, Verifiable Example](//stackoverflow.com/help/mcve). – Scott Weldon Dec 22 '16 at 19:08
4 Answers
edited 2015/03/19: The Socket.IO guys created their own iOS library that supports Socket.IO v1.0+. Get it here: https://github.com/socketio/socket.io-client-swift
old answer
I updated fpotter's socket.io library to work with version 0.7.2 - 0.9.x.
It supports sockets and XHRpolling.
https://github.com/pkyeck/socket.IO-objc
Maybe you want to check it out.

- 18,402
- 15
- 86
- 123
-
Hi pkyech. I'm using your library and it works perfect with my iOS7 app. Now I want to connect once and manage the events from each viewControllers by NSObject to avoid too many connect/disconnect. Do you have any tutorial on that? – Maziyar Jan 09 '14 at 07:14
-
-
I am adding [link](https://github.com/pkyeck/socket.IO-objc) library in Xcode 7and iOS 9. But after connection it is just giving me a response of `error code 400`. However if I am doing it in swift then it connecting correctly. Is this library of objective c is obsolete? @pkyeck – Bhupesh Kumar Dec 01 '15 at 06:41
Or have a look at cocoaasyncsocket:
CocoaAsyncSocket supports TCP and UDP. The AsyncSocket class is for TCP, and the AsyncUdpSocket class is for UDP. Each class is described below.
AsyncSocket is a TCP/IP socket networking library that wraps CFSocket and CFStream. It offers asynchronous operation, and a native cocoa class complete with delegate support. Here are the key features:
Queued non-blocking reads and writes, with optional timeouts. You tell it what to read or write, and it will call you when it's done.
Automatic socket acceptance. If you tell it to accept connections, it will call you with new instances of itself for each connection. You can, of course, disconnect them immediately.
Delegate support. Errors, connections, accepts, read completions, write completions, progress, and disconnections all result in a call to your delegate method.
Run-loop based, not thread based. Although you can use it on main or worker threads, you don't have to. It calls the delegate methods asynchronously using NSRunLoop. The delegate methods include a socket parameter, allowing you to distinguish between many instances.
Self-contained in one class. You don't need to muck around with streams or sockets. The class handles all of that.
Support for TCP streams over IPv4 and IPv6.
The library is public domain, originally written by Dustin Voss. Now available in a public setting to allow and encourage its continued support.
AsyncUdpSocket is a UDP/IP socket networking library that wraps CFSocket. It works almost exactly like the TCP version, but is designed specifically for UDP. This includes queued non-blocking send/receive operations, full delegate support, run-loop based, self-contained class, and support for IPv4 and IPv6.

- 379
- 2
- 13

- 47,228
- 12
- 98
- 108
I'd suggest checking out the Apple documentation for streaming and sockets if you are planning on doing an native app. http://developer.apple.com/library/ios/#documentation/cocoa/Conceptual/Streams/Streams.html

- 6,603
- 1
- 35
- 32
Check this out: https://github.com/fpotter/socketio-cocoa

- 2,649
- 1
- 20
- 16
-
This library doesn't seem to be maintained anymore, the git project doesn't even clone --recursive properly – Ben G Apr 02 '13 at 13:39