Skip to content

Instantly share code, notes, and snippets.

@mattt
Last active March 18, 2019 20:48
Show Gist options
  • Save mattt/9836041 to your computer and use it in GitHub Desktop.
Save mattt/9836041 to your computer and use it in GitHub Desktop.

A number of tech news outlets, including WIRED, GigaOm, and MIT Technology Review, have recently started writing about Multipeer Connectivity ("one weird trick that the NSA hates"). Since the NSHipster article on the subject has been linked to in a lot of this coverage, I wanted to share some additional thoughts on the matter:

Multipeer Connectivity(http://nshipster.com/multipeer-connectivity/) represents a significant shift in the opposite direction of how we conventionally think about mobile applications. Nearly every app on your phone operates in a client-server model, with the device making requests to remote cloud services to send and receive messages, photos, and videos. The new APIs introduced by Apple in iOS 7 make it just as easy to communicate with other devices around you instead. While this was technically possible before, creating a robust implementation was prohibitively difficult for all but the most experienced and capable development firms.

The timing is important, too: recent advances in Bluetooth technology have coincided with growing fears of domestic surveillance programs and web service data breaches. As users become more mindful of the security and privacy implications of technologies they rely on, moving back in the direction of local, ad-hoc networking like what Multipeer Connectivity provides begins to make a lot of sense. You can see similar trends in related technologies, like WebRTC, which allows browsers to connect directly to each other.

Not relying on an internet service to act as a middleman has profound implications on security and privacy. Over an encrypted, local network, you have a great degree of certainty that the person you’re communicating with is who they claim to be, and that no one else can eaves drop on your conversation.

This method of communication is immune to firewalls like the ones installed in China and North Korea. It’s immune to attempts to block social networks like Twitter, as we’ve seen done in Egypt, Libya, and Turkey. It’s immune to surveillance programs like those run by the NSA, as well as anti-competitive traffic-limiting measures from internet service providers like Comcast.

Beyond security and privacy implications, there are significant performance gains to be had as well to local networking. It’s about as fast as transferring files from your MacBook to your TimeMachine drive. And since it doesn’t rely on an internet connection, it’ll still work on the subway, or anywhere where there’s no cell coverage or WiFi available.

It’s still early for this paradigm, and I think we’ll see a lot of new applications as users and developers alike begin to understand what’s possible.

@carrchr
Copy link

carrchr commented Mar 28, 2014

AFNetworking for Bluetooth? :-)

@sjmadsen
Copy link

I sort of hate to rain on anyone's parade, but I don't think Multipeer Connectivity is able to live up to some of these ideas. Sessions are limited to eight peers and the throughput is nowhere near as good as "MacBook to your TimeMachine drive" in my experience. I blogged about it in more detail if anyone is interested.

@mattt
Copy link
Author

mattt commented Mar 28, 2014

@sjmadsen

Sessions are limited to eight peers...

That's just one session, though. Messages can be propagated across a graph of connections in a similar manner to how distributed databases are replicated across many nodes, with each only having direct connections to small number of them. It'd be great if MCSession accommodated more out-of-the-box, but this can be worked around.

and the throughput is nowhere near as good as "MacBook to your TimeMachine drive" in my experience

Forgive my imprecise language here. I didn't originally mean to imply that those speeds are achievable over Bluetooth—I was talking about local (i.e. no internet) connections, like over WiFi. That sentence has been clarified as:

Beyond security and privacy implications, there are significant performance gains to be had as well to local networking.

@jakedunc
Copy link

jakedunc commented Apr 2, 2014

hey mattt! i have so many ideas for multipeer connectivity, but it would need to work by manually managing peer connections like your FireChat app does. any chance of a tutorial anytime soon? do you use the NSNetService or the Bonjour C API?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment