mikael last edited by
Multipeer connectivity allows you to find and exchange information between 2-8 iOS and Mac devices in the same network neighborhood (same wifi or bluetooth), without going through some server.
Sample use cases include games, chats, file exchange (like AirDrop) and so on.
Here's a minimal usage example, a line-based chat. You need to be running the same code on all devices participating in the chat.
import multipeer my_name = input('Name: ') mc = multipeer.MultipeerConnectivity(display_name=my_name, service_type='chat') try: while True: chat_message = input('Message: ') mc.send(chat_message) finally: mc.end_all()
You can also run the
multipeer.pyfile to try out a cleaner Pythonista UI version of the chat.
Thanks to @wolf71 for driving the initial effort 2 years ago. Heavy lifting on the ObjC side was all on @JonB, and @dgelessus' faulthandler was again indispensable in debugging ObjC crashes. Kudos to @mithrendal for fixing the last showstopper.
wolf71 last edited by
@mikael Great Job. Thanks