iOhYes Retired


A podcast by iOS developers for iOS developers, delivering news, tips, and rants for professional iOS/Mac developers, with something for enterprise and indie developers alike.

Hosted by Darryl Thomas and John Sextro.

← Previous Episode   |   Next Episode →

103: Don’t Hate Us, Nolan

March 2, 2016 at 10:00AM • 54 minutes • Wiki Entry


Pushing info to clients

  • Long Polling
    • Client sends request to server, waits for response or timeouts (Loop)
    • Can send and receive information, but not full-duplex
    • iOS Implementation
      • NSURLConnection sendSynchronousRequest
    • Common uses
      • Fallback from Websockets and SSE when streams are unreliable or impractical
  • HTTP Streams
    • Can only push information to your client
    • If you need to send info back to server use standard rest approach
    • Transported over simple HTTP
    • Built in support for re-connection and event-id
    • iOS Implementation
      • Server Sent Events (SSE)
      • NSURLSession, NSInputStream, NSSteamEvent
      • Setup the connection
      • Implement code to handleEvents from the input stream
    • Common uses
      • Stock ticker streaming
      • “Status” feed updating
      • Push Notifications
  • Websockets
    • Designed to overcome many of the pitfalls/shortcomings described in RFC 6202
    • Standardized by IETF (Internet Engineering Task Force) in 2011
    • Can send and receive information (full-duplex pipe)
    • Protocol based on TCP
    • Uses HTTP only for initial handshake, while leveraging existing HTTP infrastructure
    • iOS Implementation
      • CFStreamCreatePairWithSocketToHost takes url, read and write stream
      • Cast read and write stream to NSInputStream and NSOutputStream, respectively
      • Set delegate for input and output streams
      • Schedule both in a run loop (Can do without but will block the execution of other code)
      • Open connection
      • Write code to handleEvents from the input stream
      • Implement message sending via the output stream
    • Server considerations
      • Not as easy to get started with as a generic web server
      • Buy one, borrow one or build one
    • Common uses
      • Chat
      • Player vs. Player games
      • Real time interactions
  • Popular Abstractions/Frameworks

At-a-glance Comparison

Websockets SSE Long Polling
Client Performance Best Best Worst
Server Performance Best Worst Worst
Complexity Highest Lowest Mid
When to Use 2-way messaging Push to Client Just getting started




Alternative show title suggestions

  • Uncanny valley
  • The cooker's always on
  • Canonical Framing Technique

Thanks to Braintree for sponsoring this episode of iOhYes. If you're building a mobile app and searching for a simple payments solution, check out Braintree. For your first $50,000 in transactions fee-free, go to

Show Notes & Links Presented by CacheFly

Tweet Shoutouts