开发者

iPhone Objective-C socket communication with Socket.IO [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 6 years ago.

开发者_如何学JAVAImprove this question

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.


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.


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.


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


Check this out: https://github.com/fpotter/socketio-cocoa

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜