SlideShare uma empresa Scribd logo
1 de 20
Baixar para ler offline
Multi-Peer Connectivity
Architecture
Multi-Peer Connectivity
•

New in iOS 7

•

Ability to connect to a mesh of peers.

•

Able to connect to peers over WiFi, ad-hoc wireless, and Bluetooth.

•

Peers must be ‘nearby’.
Terms

•

Advertiser - Broadcasts availability to connect

•

Browser - Invites advertisers to join a session
MCSession

•

MCSession manages all communication between peers.

•

Must be used by all participants.
Create A Session
self.peerID = [[MCPeerID alloc] initWithDisplayName:@"Jill"];
!

self.currentSession = [[MCSession alloc] initWithPeer:self.peerID];
self.currentSession.delegate = self;
Discovery
Browser

Advertiser

Advertiser

Who wants to
chat?

Ready to
chat!

Ready to
chat!
Advertising
self.peerID = [[MCPeerID alloc] initWithDisplayName:@"Jill"];
!

self.advertiser = [[MCNearbyServiceAdvertiser alloc] initWithPeer:self.peerID
discoveryInfo:nil
serviceType:@"whartman-chat"];
self.advertiser.delegate = self;
[self.advertiser startAdvertisingPeer];
Browsing
self.peerID = [[MCPeerID alloc] initWithDisplayName:@"Jack"];
!

self.browser = [[MCNearbyServiceBrowser alloc] initWithPeer:self.peerID
serviceType:@"whartman-chat"];
self.browser.delegate = self;
[self.browser startBrowsingForPeers];
Browser: Discover & Invite
- (void)browser:(MCNearbyServiceBrowser *)browser foundPeer:(MCPeerID *)peerID
withDiscoveryInfo:(NSDictionary *)info
{
[browser invitePeer:peerID
toSession:self.currentSession
withContext:nil
timeout:3.0];
}
Advertiser: Accept Invitation
- (void)advertiser:(MCNearbyServiceAdvertiser *)advertiser didReceiveInvitationFromPeer:
(MCPeerID *)peerID withContext:(NSData *)context invitationHandler:(void(^)(BOOL accept,
MCSession *session))invitationHandler
{
// In most cases you will want to give users an option to connect or not.
invitationHandler(YES, self.currentSession);
[self.advertiser stopAdvertisingPeer]; // Once invited, stop advertising
}
Sending Data To Peers
NSDictionary *message = @{ @"message" : @"Hello!" };
NSData *messageData = [NSJSONSerialization dataWithJSONObject:message options:0 error:nil];
!

NSError *error = nil;
!

[self.currentSession sendData:messageData
toPeers:self.currentSession.connectedPeers
withMode:MCSessionSendDataReliable
error:&error];
Receiving Data From Peers
- (void)session:(MCSession *)session didReceiveData:(NSData *)data fromPeer:(MCPeerID *)peerID {
NSError *error = nil;
!

NSDictionary *recievedData = [NSJSONSerialization JSONObjectWithData:data
options:0
error:&error];
!

if (!recievedData) {
NSLog(@"error decoding message! %@", error);
} else {
// Display message to the user...
}
}
Sending Resources To Peers
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"hello" ofType:@"jpg"];
NSURL *imageURL = [NSURL fileURLWithPath:filePath];
!

[self.currentSession sendResourceAtURL:imageURL
withName:@"hello.jpg"
toPeer:peer
withCompletionHandler:^(NSError *error) {
if (error) {
NSLog(@"Error sending image! %@", error);
}
}];
Receiving Resources From Peers
- (void)session:(MCSession *)session didStartReceivingResourceWithName:(NSString *)resourceName
fromPeer:(MCPeerID *)peerID withProgress:(NSProgress *)progress {
NSLog(@"downloading file: %f%%", progress.fractionCompleted);
}
!
!
!
!

- (void)session:(MCSession *)session didFinishReceivingResourceWithName:(NSString *)resourceName
fromPeer:(MCPeerID *)peerID atURL:(NSURL *)localURL withError:(NSError *)error {
!

if (error) {
NSLog(@"Error when receiving file! %@", error);
} else {
// Present the resource to the user.
}
}
Demo
Best Practices
•

Keep messages short.

•

Be careful with inviting/accept invitations.

•

As an advertiser, once you have accepted an invitation, stop advertising.
Limitations

•

Limit to 8 connected peers.

•

Data transfer is slow—especially on Bluetooth.
Questions?
Resources

•

Nearby Networking with Multipeer Connectivity (WWDC 2013)

•

Demo App - https://github.com/waynehartman/MultiPeerTest/

Mais conteúdo relacionado

Mais procurados

Alfresco勉強会#28 alfresco 5.0の検索機能をみてみよう
Alfresco勉強会#28 alfresco 5.0の検索機能をみてみようAlfresco勉強会#28 alfresco 5.0の検索機能をみてみよう
Alfresco勉強会#28 alfresco 5.0の検索機能をみてみようTasuku Otani
 
Alfresco Bulk Import toolのご紹介
Alfresco Bulk Import toolのご紹介Alfresco Bulk Import toolのご紹介
Alfresco Bulk Import toolのご紹介MoritakaSoma
 
Android audio system(audioflinger)
Android audio system(audioflinger)Android audio system(audioflinger)
Android audio system(audioflinger)fefe7270
 
Container Runtime Security with Falco, by Néstor Salceda
Container Runtime Security with Falco, by Néstor SalcedaContainer Runtime Security with Falco, by Néstor Salceda
Container Runtime Security with Falco, by Néstor SalcedaCloud Native Day Tel Aviv
 
[AIX] RDX Device Backup Guide
[AIX] RDX Device Backup Guide[AIX] RDX Device Backup Guide
[AIX] RDX Device Backup GuideCheolHee Han
 
啟動 Laravel 與環境設定
啟動 Laravel 與環境設定啟動 Laravel 與環境設定
啟動 Laravel 與環境設定Shengyou Fan
 
Page cache in Linux kernel
Page cache in Linux kernelPage cache in Linux kernel
Page cache in Linux kernelAdrian Huang
 
Event Storming and Implementation Workshop
Event Storming and Implementation WorkshopEvent Storming and Implementation Workshop
Event Storming and Implementation WorkshopuEngine Solutions
 
High Performance Scaling Techniques in Golang Using Go Assembly
High Performance Scaling Techniques in Golang Using Go AssemblyHigh Performance Scaling Techniques in Golang Using Go Assembly
High Performance Scaling Techniques in Golang Using Go AssemblyMinio
 
Android media framework overview
Android media framework overviewAndroid media framework overview
Android media framework overviewJerrin George
 
Linux Kernel - Virtual File System
Linux Kernel - Virtual File SystemLinux Kernel - Virtual File System
Linux Kernel - Virtual File SystemAdrian Huang
 
GitLab Premium 라이선스 기능소개 - 인포그랩
GitLab Premium 라이선스 기능소개 - 인포그랩GitLab Premium 라이선스 기능소개 - 인포그랩
GitLab Premium 라이선스 기능소개 - 인포그랩InfoGrab LC
 
全社情報共有サイトへの Alfresco Community 5 導入事例紹介 - 第27回Alfresco勉強会
全社情報共有サイトへのAlfresco Community 5 導入事例紹介 - 第27回Alfresco勉強会全社情報共有サイトへのAlfresco Community 5 導入事例紹介 - 第27回Alfresco勉強会
全社情報共有サイトへの Alfresco Community 5 導入事例紹介 - 第27回Alfresco勉強会Ryota Watabe
 
JBoss EAP 설치 가이드
JBoss EAP 설치 가이드 JBoss EAP 설치 가이드
JBoss EAP 설치 가이드 Opennaru, inc.
 
Update on DSpace 7
Update on DSpace 7Update on DSpace 7
Update on DSpace 7Bram Luyten
 
[2019] DDD Lite@Spring
[2019] DDD Lite@Spring[2019] DDD Lite@Spring
[2019] DDD Lite@SpringNHN FORWARD
 

Mais procurados (20)

Alfresco勉強会#28 alfresco 5.0の検索機能をみてみよう
Alfresco勉強会#28 alfresco 5.0の検索機能をみてみようAlfresco勉強会#28 alfresco 5.0の検索機能をみてみよう
Alfresco勉強会#28 alfresco 5.0の検索機能をみてみよう
 
Alfresco Bulk Import toolのご紹介
Alfresco Bulk Import toolのご紹介Alfresco Bulk Import toolのご紹介
Alfresco Bulk Import toolのご紹介
 
Android audio system(audioflinger)
Android audio system(audioflinger)Android audio system(audioflinger)
Android audio system(audioflinger)
 
Presentation swagger
Presentation swaggerPresentation swagger
Presentation swagger
 
Container Runtime Security with Falco, by Néstor Salceda
Container Runtime Security with Falco, by Néstor SalcedaContainer Runtime Security with Falco, by Néstor Salceda
Container Runtime Security with Falco, by Néstor Salceda
 
[AIX] RDX Device Backup Guide
[AIX] RDX Device Backup Guide[AIX] RDX Device Backup Guide
[AIX] RDX Device Backup Guide
 
啟動 Laravel 與環境設定
啟動 Laravel 與環境設定啟動 Laravel 與環境設定
啟動 Laravel 與環境設定
 
Page cache in Linux kernel
Page cache in Linux kernelPage cache in Linux kernel
Page cache in Linux kernel
 
Event Storming and Implementation Workshop
Event Storming and Implementation WorkshopEvent Storming and Implementation Workshop
Event Storming and Implementation Workshop
 
High Performance Scaling Techniques in Golang Using Go Assembly
High Performance Scaling Techniques in Golang Using Go AssemblyHigh Performance Scaling Techniques in Golang Using Go Assembly
High Performance Scaling Techniques in Golang Using Go Assembly
 
Android media framework overview
Android media framework overviewAndroid media framework overview
Android media framework overview
 
Linux Kernel - Virtual File System
Linux Kernel - Virtual File SystemLinux Kernel - Virtual File System
Linux Kernel - Virtual File System
 
JAX-WS e JAX-RS
JAX-WS e JAX-RSJAX-WS e JAX-RS
JAX-WS e JAX-RS
 
GitLab Premium 라이선스 기능소개 - 인포그랩
GitLab Premium 라이선스 기능소개 - 인포그랩GitLab Premium 라이선스 기능소개 - 인포그랩
GitLab Premium 라이선스 기능소개 - 인포그랩
 
全社情報共有サイトへの Alfresco Community 5 導入事例紹介 - 第27回Alfresco勉強会
全社情報共有サイトへのAlfresco Community 5 導入事例紹介 - 第27回Alfresco勉強会全社情報共有サイトへのAlfresco Community 5 導入事例紹介 - 第27回Alfresco勉強会
全社情報共有サイトへの Alfresco Community 5 導入事例紹介 - 第27回Alfresco勉強会
 
JBoss EAP 설치 가이드
JBoss EAP 설치 가이드 JBoss EAP 설치 가이드
JBoss EAP 설치 가이드
 
Update on DSpace 7
Update on DSpace 7Update on DSpace 7
Update on DSpace 7
 
【第1.5回勉強会】後編 alfrescoの基本操作
【第1.5回勉強会】後編 alfrescoの基本操作【第1.5回勉強会】後編 alfrescoの基本操作
【第1.5回勉強会】後編 alfrescoの基本操作
 
[2019] DDD Lite@Spring
[2019] DDD Lite@Spring[2019] DDD Lite@Spring
[2019] DDD Lite@Spring
 
AlfrescoとSolr(中編)
AlfrescoとSolr(中編)AlfrescoとSolr(中編)
AlfrescoとSolr(中編)
 

Destaque

Multipeer Connectivity Framework
Multipeer Connectivity FrameworkMultipeer Connectivity Framework
Multipeer Connectivity FrameworkJorge Ortiz
 
Multiplayer games on iOS
Multiplayer games on iOSMultiplayer games on iOS
Multiplayer games on iOSMagnus Jahnen
 
2014.06.26 CocoaHeads - Multipeer Connectivity Framework
2014.06.26 CocoaHeads - Multipeer Connectivity Framework 2014.06.26 CocoaHeads - Multipeer Connectivity Framework
2014.06.26 CocoaHeads - Multipeer Connectivity Framework Po-wei Chang
 
A Swift Path to Productivity
A Swift Path to ProductivityA Swift Path to Productivity
A Swift Path to Productivityibmmobile
 
Swift Generics in Theory and Practice
Swift Generics in Theory and PracticeSwift Generics in Theory and Practice
Swift Generics in Theory and PracticeMichele Titolo
 
Message Signaled Interrupts
Message Signaled InterruptsMessage Signaled Interrupts
Message Signaled InterruptsAnshuman Biswal
 

Destaque (6)

Multipeer Connectivity Framework
Multipeer Connectivity FrameworkMultipeer Connectivity Framework
Multipeer Connectivity Framework
 
Multiplayer games on iOS
Multiplayer games on iOSMultiplayer games on iOS
Multiplayer games on iOS
 
2014.06.26 CocoaHeads - Multipeer Connectivity Framework
2014.06.26 CocoaHeads - Multipeer Connectivity Framework 2014.06.26 CocoaHeads - Multipeer Connectivity Framework
2014.06.26 CocoaHeads - Multipeer Connectivity Framework
 
A Swift Path to Productivity
A Swift Path to ProductivityA Swift Path to Productivity
A Swift Path to Productivity
 
Swift Generics in Theory and Practice
Swift Generics in Theory and PracticeSwift Generics in Theory and Practice
Swift Generics in Theory and Practice
 
Message Signaled Interrupts
Message Signaled InterruptsMessage Signaled Interrupts
Message Signaled Interrupts
 

Semelhante a Multipeer Connectivity

iPhone project - Wireless networks seminar
iPhone project - Wireless networks seminariPhone project - Wireless networks seminar
iPhone project - Wireless networks seminarSilvio Daminato
 
NSCoder Keynote - Multipeer Connectivity Framework
NSCoder Keynote - Multipeer Connectivity FrameworkNSCoder Keynote - Multipeer Connectivity Framework
NSCoder Keynote - Multipeer Connectivity FrameworkAlex Rupérez
 
SenchaCon 2016: Handle Real-World Data with Confidence - Fredric Berling
SenchaCon 2016: Handle Real-World Data with Confidence - Fredric Berling SenchaCon 2016: Handle Real-World Data with Confidence - Fredric Berling
SenchaCon 2016: Handle Real-World Data with Confidence - Fredric Berling Sencha
 
A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...
A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...
A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...DataLeader.io
 
Tutorial: Building Your First App with MongoDB Stitch
Tutorial: Building Your First App with MongoDB StitchTutorial: Building Your First App with MongoDB Stitch
Tutorial: Building Your First App with MongoDB StitchMongoDB
 
SharePoint Conference 2018 - Build an intelligent application by connecting i...
SharePoint Conference 2018 - Build an intelligent application by connecting i...SharePoint Conference 2018 - Build an intelligent application by connecting i...
SharePoint Conference 2018 - Build an intelligent application by connecting i...Sébastien Levert
 
Synchronizing without internet - Multipeer Connectivity (iOS)
Synchronizing without internet - Multipeer Connectivity (iOS)Synchronizing without internet - Multipeer Connectivity (iOS)
Synchronizing without internet - Multipeer Connectivity (iOS)Jorge Maroto
 
Building Your First App with MongoDB Stitch
Building Your First App with MongoDB StitchBuilding Your First App with MongoDB Stitch
Building Your First App with MongoDB StitchMongoDB
 
Building interactivity with websockets
Building interactivity with websocketsBuilding interactivity with websockets
Building interactivity with websocketsWim Godden
 
Insight User Conference Bootcamp - Use the Engagement Tracking and Metrics A...
Insight User Conference Bootcamp - Use the Engagement Tracking  and Metrics A...Insight User Conference Bootcamp - Use the Engagement Tracking  and Metrics A...
Insight User Conference Bootcamp - Use the Engagement Tracking and Metrics A...SparkPost
 
Serverless Application Development with MongoDB Stitch
Serverless Application Development with MongoDB StitchServerless Application Development with MongoDB Stitch
Serverless Application Development with MongoDB StitchMichael Lynn
 
Micro app-framework - NodeLive Boston
Micro app-framework - NodeLive BostonMicro app-framework - NodeLive Boston
Micro app-framework - NodeLive BostonMichael Dawson
 
MongoDB.local Sydney: Evolving your Data Access with MongoDB Stitch
MongoDB.local Sydney: Evolving your Data Access with MongoDB StitchMongoDB.local Sydney: Evolving your Data Access with MongoDB Stitch
MongoDB.local Sydney: Evolving your Data Access with MongoDB StitchMongoDB
 
[MongoDB.local Bengaluru 2018] Introduction to MongoDB Stitch
[MongoDB.local Bengaluru 2018] Introduction to MongoDB Stitch[MongoDB.local Bengaluru 2018] Introduction to MongoDB Stitch
[MongoDB.local Bengaluru 2018] Introduction to MongoDB StitchMongoDB
 
Présentation et bonnes pratiques du pattern MVVM - MIC Belgique
Présentation et bonnes pratiques du pattern MVVM - MIC BelgiquePrésentation et bonnes pratiques du pattern MVVM - MIC Belgique
Présentation et bonnes pratiques du pattern MVVM - MIC BelgiqueDenis Voituron
 
MongoDB Stitch Introduction
MongoDB Stitch IntroductionMongoDB Stitch Introduction
MongoDB Stitch IntroductionMongoDB
 
European SharePoint Conference 2018 - Build an intelligent application by con...
European SharePoint Conference 2018 - Build an intelligent application by con...European SharePoint Conference 2018 - Build an intelligent application by con...
European SharePoint Conference 2018 - Build an intelligent application by con...Sébastien Levert
 
MongoDB.local Atlanta: Introduction to Serverless MongoDB
MongoDB.local Atlanta: Introduction to Serverless MongoDBMongoDB.local Atlanta: Introduction to Serverless MongoDB
MongoDB.local Atlanta: Introduction to Serverless MongoDBMongoDB
 
How Signpost uses MongoDB for Tracking and Analytics
How Signpost uses MongoDB for Tracking and AnalyticsHow Signpost uses MongoDB for Tracking and Analytics
How Signpost uses MongoDB for Tracking and Analyticsmattinsler
 

Semelhante a Multipeer Connectivity (20)

iPhone project - Wireless networks seminar
iPhone project - Wireless networks seminariPhone project - Wireless networks seminar
iPhone project - Wireless networks seminar
 
NSCoder Keynote - Multipeer Connectivity Framework
NSCoder Keynote - Multipeer Connectivity FrameworkNSCoder Keynote - Multipeer Connectivity Framework
NSCoder Keynote - Multipeer Connectivity Framework
 
SenchaCon 2016: Handle Real-World Data with Confidence - Fredric Berling
SenchaCon 2016: Handle Real-World Data with Confidence - Fredric Berling SenchaCon 2016: Handle Real-World Data with Confidence - Fredric Berling
SenchaCon 2016: Handle Real-World Data with Confidence - Fredric Berling
 
A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...
A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...
A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...
 
Tutorial: Building Your First App with MongoDB Stitch
Tutorial: Building Your First App with MongoDB StitchTutorial: Building Your First App with MongoDB Stitch
Tutorial: Building Your First App with MongoDB Stitch
 
SharePoint Conference 2018 - Build an intelligent application by connecting i...
SharePoint Conference 2018 - Build an intelligent application by connecting i...SharePoint Conference 2018 - Build an intelligent application by connecting i...
SharePoint Conference 2018 - Build an intelligent application by connecting i...
 
Synchronizing without internet - Multipeer Connectivity (iOS)
Synchronizing without internet - Multipeer Connectivity (iOS)Synchronizing without internet - Multipeer Connectivity (iOS)
Synchronizing without internet - Multipeer Connectivity (iOS)
 
Building Your First App with MongoDB Stitch
Building Your First App with MongoDB StitchBuilding Your First App with MongoDB Stitch
Building Your First App with MongoDB Stitch
 
Building interactivity with websockets
Building interactivity with websocketsBuilding interactivity with websockets
Building interactivity with websockets
 
Insight User Conference Bootcamp - Use the Engagement Tracking and Metrics A...
Insight User Conference Bootcamp - Use the Engagement Tracking  and Metrics A...Insight User Conference Bootcamp - Use the Engagement Tracking  and Metrics A...
Insight User Conference Bootcamp - Use the Engagement Tracking and Metrics A...
 
Serverless Application Development with MongoDB Stitch
Serverless Application Development with MongoDB StitchServerless Application Development with MongoDB Stitch
Serverless Application Development with MongoDB Stitch
 
Micro app-framework - NodeLive Boston
Micro app-framework - NodeLive BostonMicro app-framework - NodeLive Boston
Micro app-framework - NodeLive Boston
 
Micro app-framework
Micro app-frameworkMicro app-framework
Micro app-framework
 
MongoDB.local Sydney: Evolving your Data Access with MongoDB Stitch
MongoDB.local Sydney: Evolving your Data Access with MongoDB StitchMongoDB.local Sydney: Evolving your Data Access with MongoDB Stitch
MongoDB.local Sydney: Evolving your Data Access with MongoDB Stitch
 
[MongoDB.local Bengaluru 2018] Introduction to MongoDB Stitch
[MongoDB.local Bengaluru 2018] Introduction to MongoDB Stitch[MongoDB.local Bengaluru 2018] Introduction to MongoDB Stitch
[MongoDB.local Bengaluru 2018] Introduction to MongoDB Stitch
 
Présentation et bonnes pratiques du pattern MVVM - MIC Belgique
Présentation et bonnes pratiques du pattern MVVM - MIC BelgiquePrésentation et bonnes pratiques du pattern MVVM - MIC Belgique
Présentation et bonnes pratiques du pattern MVVM - MIC Belgique
 
MongoDB Stitch Introduction
MongoDB Stitch IntroductionMongoDB Stitch Introduction
MongoDB Stitch Introduction
 
European SharePoint Conference 2018 - Build an intelligent application by con...
European SharePoint Conference 2018 - Build an intelligent application by con...European SharePoint Conference 2018 - Build an intelligent application by con...
European SharePoint Conference 2018 - Build an intelligent application by con...
 
MongoDB.local Atlanta: Introduction to Serverless MongoDB
MongoDB.local Atlanta: Introduction to Serverless MongoDBMongoDB.local Atlanta: Introduction to Serverless MongoDB
MongoDB.local Atlanta: Introduction to Serverless MongoDB
 
How Signpost uses MongoDB for Tracking and Analytics
How Signpost uses MongoDB for Tracking and AnalyticsHow Signpost uses MongoDB for Tracking and Analytics
How Signpost uses MongoDB for Tracking and Analytics
 

Último

Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 

Último (20)

Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

Multipeer Connectivity

  • 3. Multi-Peer Connectivity • New in iOS 7 • Ability to connect to a mesh of peers. • Able to connect to peers over WiFi, ad-hoc wireless, and Bluetooth. • Peers must be ‘nearby’.
  • 4. Terms • Advertiser - Broadcasts availability to connect • Browser - Invites advertisers to join a session
  • 5. MCSession • MCSession manages all communication between peers. • Must be used by all participants.
  • 6. Create A Session self.peerID = [[MCPeerID alloc] initWithDisplayName:@"Jill"]; ! self.currentSession = [[MCSession alloc] initWithPeer:self.peerID]; self.currentSession.delegate = self;
  • 8. Advertising self.peerID = [[MCPeerID alloc] initWithDisplayName:@"Jill"]; ! self.advertiser = [[MCNearbyServiceAdvertiser alloc] initWithPeer:self.peerID discoveryInfo:nil serviceType:@"whartman-chat"]; self.advertiser.delegate = self; [self.advertiser startAdvertisingPeer];
  • 9. Browsing self.peerID = [[MCPeerID alloc] initWithDisplayName:@"Jack"]; ! self.browser = [[MCNearbyServiceBrowser alloc] initWithPeer:self.peerID serviceType:@"whartman-chat"]; self.browser.delegate = self; [self.browser startBrowsingForPeers];
  • 10. Browser: Discover & Invite - (void)browser:(MCNearbyServiceBrowser *)browser foundPeer:(MCPeerID *)peerID withDiscoveryInfo:(NSDictionary *)info { [browser invitePeer:peerID toSession:self.currentSession withContext:nil timeout:3.0]; }
  • 11. Advertiser: Accept Invitation - (void)advertiser:(MCNearbyServiceAdvertiser *)advertiser didReceiveInvitationFromPeer: (MCPeerID *)peerID withContext:(NSData *)context invitationHandler:(void(^)(BOOL accept, MCSession *session))invitationHandler { // In most cases you will want to give users an option to connect or not. invitationHandler(YES, self.currentSession); [self.advertiser stopAdvertisingPeer]; // Once invited, stop advertising }
  • 12. Sending Data To Peers NSDictionary *message = @{ @"message" : @"Hello!" }; NSData *messageData = [NSJSONSerialization dataWithJSONObject:message options:0 error:nil]; ! NSError *error = nil; ! [self.currentSession sendData:messageData toPeers:self.currentSession.connectedPeers withMode:MCSessionSendDataReliable error:&error];
  • 13. Receiving Data From Peers - (void)session:(MCSession *)session didReceiveData:(NSData *)data fromPeer:(MCPeerID *)peerID { NSError *error = nil; ! NSDictionary *recievedData = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error]; ! if (!recievedData) { NSLog(@"error decoding message! %@", error); } else { // Display message to the user... } }
  • 14. Sending Resources To Peers NSString *filePath = [[NSBundle mainBundle] pathForResource:@"hello" ofType:@"jpg"]; NSURL *imageURL = [NSURL fileURLWithPath:filePath]; ! [self.currentSession sendResourceAtURL:imageURL withName:@"hello.jpg" toPeer:peer withCompletionHandler:^(NSError *error) { if (error) { NSLog(@"Error sending image! %@", error); } }];
  • 15. Receiving Resources From Peers - (void)session:(MCSession *)session didStartReceivingResourceWithName:(NSString *)resourceName fromPeer:(MCPeerID *)peerID withProgress:(NSProgress *)progress { NSLog(@"downloading file: %f%%", progress.fractionCompleted); } ! ! ! ! - (void)session:(MCSession *)session didFinishReceivingResourceWithName:(NSString *)resourceName fromPeer:(MCPeerID *)peerID atURL:(NSURL *)localURL withError:(NSError *)error { ! if (error) { NSLog(@"Error when receiving file! %@", error); } else { // Present the resource to the user. } }
  • 16. Demo
  • 17. Best Practices • Keep messages short. • Be careful with inviting/accept invitations. • As an advertiser, once you have accepted an invitation, stop advertising.
  • 18. Limitations • Limit to 8 connected peers. • Data transfer is slow—especially on Bluetooth.
  • 20. Resources • Nearby Networking with Multipeer Connectivity (WWDC 2013) • Demo App - https://github.com/waynehartman/MultiPeerTest/