Possible Duplicates:
WebSockets vs TCP/IP vs JavaScript/AJAX for iPhone chat How to incorporate We开发者_StackOverflow中文版bSockets into a Cocoa application
Hey guys, our team is planning on developing a native iPhone chat application and are considering using WebSockets. How could we go about doing this (if possible)? Would we have to use an instance of UIWebView to do this? And could we program the server side code in C#?
Any other information on the topic would also be much appreciated.
Thank you in advance!
There are lots of Websocket servers available for a variety of different languages and runtime environments. Probably best using the platform you know best. The client side is less developed, because the main point of WebSockets is to have a bi-directional messaging channel in the web browser. Outside the web browser, there are usually better options, as you can just open a raw socket. You may well be able to find a WebSocket client for C, C++ or Objective-C though. Other than that, you could probably use an existing HTTP client library to implement WebSocket support, as long as the library allows keeping the request stream open.
For chat in general, if you're not restricted to WebSockets/COMET (which you usually only are in a web browser), you might want to look at XMPP/Jabber. There are robust servers and client libraries available for it, it's specifically designed for chat, and may save you a lot of work.
精彩评论