You can use NSStream
and CSStream
to communicate from within your iOS
apps to a TCP
server. Keeping an open socket connection with your server will allow the server to send you a notification about the new message instantly. You will need an output stream (NSOutputStream
) and an input stream (NSInputStream
) so you can manage outgoing and incoming communications easily and in parallel.
Some useful links:
Introduction to Stream Programming Guide for Cocoa
How To Create A Socket Based iPhone App and Server
Tutorial: Building A Simple iOS TCP Socket Based App Client And Server