SlideShare a Scribd company logo
1 of 18
Download to read offline
Port
Example
@hendrikEbbers
www.guigarage.com
hendrik.ebbers@web.de
Bonjour
Don‘t be afraid no
French today
Content
• ZeroConf & Bonjour
• AirPlay
• Java API
• Demos
keep your
fingers crossed
for me
HomeAutomationModule
Welcome,
please configure your Home Automation Server:
IP-Adress
Port
ok
Example
Spooky,
isn‘t it?
ANTIPATTERN!!
HomeAutomationModule
Hi,
please choose your Home Automation Server:
ok
HA Server living room (12.0.0.34:9001)
My Server pool house (12.0.0.31:9001)
This is how it goes
Cool,
isn‘t it?
ZeroConf
• methodology and set of special technologies
• automatically create a usable computer network
• assign numeric network addresses to devices
• distribution and resolution of hostnames
• location of network services
Bonjour
• Based on ZeroConf
• provides a general method to discover services
on a local area network
• Used in many tools & applications
• Open Source
postgreSQL,
Adobe Creative
Suite, Skype
...
Airplay
• Default Services based on Bonjour
• Stream Music, Movies & Photos from iOS
to AppleTV
• No configuration needed
Find this icon on
your iDevice
User has
time for
other stuff
Defining a Service
• Each service has a type that is defined by a
namespace
• „_servicetype._tcp.local.“
• Each service has a name
• Each service has a host and a port
• Services can have descriptions and other properties
• iOS Devices can stream Photos to AppleTV
• Communication is based on Bonjour & REST
• Find AirPlay Server with Bonjour
• Send pictures with REST call
Stream Photos
REST call
Stream Music
• iOS Devices can stream Music to AppleTV
• Same Workflow as with pictures
• _airplay._tcp.local.
• Communication is completely based on REST
default service
type for
Airplay
... and
documented in
the web
JmDNS
• Java implementation of multi-cast DNS
• fully compatible with Apple's Bonjour
• provide simple ways for services to register
themselves
• discover multicast DNS based services
http://jmdns.sourceforge.net
Listen to a Service
JmDNS jmDNS = JmDNS.create();
jmDNS.addServiceListener("name._tcp.local.", new ServiceListener()
{
@Override
! ! ! public void serviceAdded(ServiceEvent event) {...}
! ! ! @Override
! ! ! public void serviceResolved(ServiceEvent event) {...}
! ! ! @Override
! ! ! public void serviceRemoved(ServiceEvent event) {...}
}
);
create Context
listener
concept
lifecylce
wraps all infos
Listen to a Service
@Override
public void serviceResolved(ServiceEvent event) {
! System.out.println("Type:" + event.getType());
! System.out.println("Name:" + event.getName());
! ! ! !
! System.out.println("IP:" + event.getInfo().getHostAddress());
! System.out.println("Port:" + event.getInfo().getPort());
! System.out.println("Name:" + event.getInfo().getName());
! System.out.println("Desc:" + event.getInfo().getNiceTextString());
! System.out.println("Entry Point:" + event.getInfo().getURL());
}
optional properties
Create a Service
JmDNS jmDNS = JmDNS.create();
ServiceInfo info = ServiceInfo.create("_demo1._tcp.local.",
"Demo 1",
9090,
"I‘m a demo");
jmDNS.registerService(info);
create Context
register on network
type, name, port,
description
Example
//Server
RestServer server = new RestServer();
server.startMp3Player(„/play“, 9090);
JmDNS jmDNS = JmDNS.create();
ServiceInfo info = ServiceInfo.create("playmp3._tcp.local.",
"MP3 Player",
9090,
"play a mp3 file");
jmDNS.registerService(info);
//Client
jmDNS.addServiceListener("playmp3._tcp.local.", new ServiceListener()
{
@Override
! ! ! public void serviceAdded(ServiceEvent event) {
RestClient.play(„tuut.mp3“, event, „/play“);
}
});
create REST Server
create DNS Service
REST Call
REST
• Implement your services as REST WS
• Client only needs to know the URL path
• I usedVert.x
You can use
any REST API
Cause it`s cool
Port
Example
Demo
Time
Port
Example
Thanks for
watching
@hendrikEbbers
www.guigarage.com
hendrik.ebbers@web.de
Thanks
for
watching

More Related Content

What's hot

Cisco asa dhcp services
Cisco asa dhcp servicesCisco asa dhcp services
Cisco asa dhcp services
IT Tech
 

What's hot (20)

Zero Configuration Networking
Zero Configuration NetworkingZero Configuration Networking
Zero Configuration Networking
 
Local-Link Networking
Local-Link NetworkingLocal-Link Networking
Local-Link Networking
 
Jingle: Cutting Edge VoIP
Jingle: Cutting Edge VoIPJingle: Cutting Edge VoIP
Jingle: Cutting Edge VoIP
 
Ipo spaces calling document-v1
Ipo spaces calling document-v1Ipo spaces calling document-v1
Ipo spaces calling document-v1
 
Kamailio World 2018: Having fun with new stuff
Kamailio World 2018: Having fun with new stuffKamailio World 2018: Having fun with new stuff
Kamailio World 2018: Having fun with new stuff
 
Data communication part 7
Data communication part 7Data communication part 7
Data communication part 7
 
Nat
NatNat
Nat
 
Network address translation
Network address translationNetwork address translation
Network address translation
 
Network address translation
Network address translationNetwork address translation
Network address translation
 
Astricon 2010: Scaling Asterisk installations
Astricon 2010: Scaling Asterisk installationsAstricon 2010: Scaling Asterisk installations
Astricon 2010: Scaling Asterisk installations
 
WebRTC and Janus intro for FOSS Stockholm January 2019
WebRTC and Janus intro for FOSS Stockholm January 2019WebRTC and Janus intro for FOSS Stockholm January 2019
WebRTC and Janus intro for FOSS Stockholm January 2019
 
Nat pat
Nat patNat pat
Nat pat
 
FOSS Sthlm: Realtime Communication Update
FOSS Sthlm: Realtime Communication UpdateFOSS Sthlm: Realtime Communication Update
FOSS Sthlm: Realtime Communication Update
 
Network Address Translation (NAT)
Network Address Translation (NAT)Network Address Translation (NAT)
Network Address Translation (NAT)
 
SWIFT: Tango's Infrastructure For Real-Time Video Call Service
SWIFT: Tango's Infrastructure For Real-Time Video Call ServiceSWIFT: Tango's Infrastructure For Real-Time Video Call Service
SWIFT: Tango's Infrastructure For Real-Time Video Call Service
 
netty_qcon_v4
netty_qcon_v4netty_qcon_v4
netty_qcon_v4
 
Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat
Build HA Asterisk on Microsoft Azure using DRBD/HeartbeatBuild HA Asterisk on Microsoft Azure using DRBD/Heartbeat
Build HA Asterisk on Microsoft Azure using DRBD/Heartbeat
 
Cisco asa dhcp services
Cisco asa dhcp servicesCisco asa dhcp services
Cisco asa dhcp services
 
Kamailio - SIP Servers Everywhere
Kamailio - SIP Servers EverywhereKamailio - SIP Servers Everywhere
Kamailio - SIP Servers Everywhere
 
Asterisk Deployments
Asterisk DeploymentsAsterisk Deployments
Asterisk Deployments
 

Viewers also liked

Discover Berry 2011
Discover Berry 2011Discover Berry 2011
Discover Berry 2011
kinsey_stout
 
Starting a business in the us as a foreigner by romy b. jurado
Starting a business in the us as a foreigner by romy b. juradoStarting a business in the us as a foreigner by romy b. jurado
Starting a business in the us as a foreigner by romy b. jurado
Jurado & Farshchian, P.L.
 
"Measurement of 0.4 kV network grid using DAQ and MATLAB / SIMULINK"
"Measurement of 0.4 kV network grid using DAQ and MATLAB / SIMULINK""Measurement of 0.4 kV network grid using DAQ and MATLAB / SIMULINK"
"Measurement of 0.4 kV network grid using DAQ and MATLAB / SIMULINK"
Faris Karić
 
Civil war journal project
Civil war journal projectCivil war journal project
Civil war journal project
keboruff
 

Viewers also liked (19)

Apple Bonjour: Let's Talk!
Apple Bonjour: Let's Talk!Apple Bonjour: Let's Talk!
Apple Bonjour: Let's Talk!
 
DNS-SD
DNS-SDDNS-SD
DNS-SD
 
好可愛
好可愛好可愛
好可愛
 
Discover Berry 2011
Discover Berry 2011Discover Berry 2011
Discover Berry 2011
 
Algae x簡報4
Algae x簡報4Algae x簡報4
Algae x簡報4
 
Leaders With No Title
Leaders With No TitleLeaders With No Title
Leaders With No Title
 
Starting a business in the us as a foreigner by romy b. jurado
Starting a business in the us as a foreigner by romy b. juradoStarting a business in the us as a foreigner by romy b. jurado
Starting a business in the us as a foreigner by romy b. jurado
 
Algae x簡報-一般業務
Algae x簡報-一般業務Algae x簡報-一般業務
Algae x簡報-一般業務
 
אילנה דמארי הכהן - הולנד
אילנה דמארי הכהן - הולנדאילנה דמארי הכהן - הולנד
אילנה דמארי הכהן - הולנד
 
認證說明
認證說明認證說明
認證說明
 
אילנה דמארי - מצגת תמונות הר מירון
אילנה דמארי - מצגת תמונות הר מירוןאילנה דמארי - מצגת תמונות הר מירון
אילנה דמארי - מצגת תמונות הר מירון
 
רעיונות יצירתיים לעיצוב אילנה דמארי
רעיונות יצירתיים לעיצוב   אילנה דמארירעיונות יצירתיים לעיצוב   אילנה דמארי
רעיונות יצירתיים לעיצוב אילנה דמארי
 
Leaders With No Title
Leaders With No TitleLeaders With No Title
Leaders With No Title
 
קרנבל בבאזל אילנה דמארי
קרנבל בבאזל   אילנה דמאריקרנבל בבאזל   אילנה דמארי
קרנבל בבאזל אילנה דמארי
 
פסלי רחוב- אילנה דמארי הכהן
פסלי רחוב- אילנה דמארי הכהןפסלי רחוב- אילנה דמארי הכהן
פסלי רחוב- אילנה דמארי הכהן
 
"Measurement of 0.4 kV network grid using DAQ and MATLAB / SIMULINK"
"Measurement of 0.4 kV network grid using DAQ and MATLAB / SIMULINK""Measurement of 0.4 kV network grid using DAQ and MATLAB / SIMULINK"
"Measurement of 0.4 kV network grid using DAQ and MATLAB / SIMULINK"
 
Civil war journal project
Civil war journal projectCivil war journal project
Civil war journal project
 
PLASMA
PLASMAPLASMA
PLASMA
 
אילנה דמארי - רדיקלים חופשיים בדם
אילנה דמארי - רדיקלים חופשיים בדםאילנה דמארי - רדיקלים חופשיים בדם
אילנה דמארי - רדיקלים חופשיים בדם
 

Similar to Bonjour for Java

Intro to node and mongodb 1
Intro to node and mongodb   1Intro to node and mongodb   1
Intro to node and mongodb 1
Mohammad Qureshi
 

Similar to Bonjour for Java (20)

APIs, now and in the future
APIs, now and in the futureAPIs, now and in the future
APIs, now and in the future
 
Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"
Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"
Lviv MD Day 2015 Олексій Озун "Introduction to the new Apple TV and TVos"
 
Signal R 2015
Signal R 2015Signal R 2015
Signal R 2015
 
Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)
Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)
Building A Streaming Apple TV App (CocoaConf San Jose, Nov 2016)
 
About Clack
About ClackAbout Clack
About Clack
 
«Real Time» Web Applications with SignalR in ASP.NET
«Real Time» Web Applications with SignalR in ASP.NET«Real Time» Web Applications with SignalR in ASP.NET
«Real Time» Web Applications with SignalR in ASP.NET
 
What is Node.js? (ICON UK)
What is Node.js? (ICON UK)What is Node.js? (ICON UK)
What is Node.js? (ICON UK)
 
APIs for modern web apps
APIs for modern web appsAPIs for modern web apps
APIs for modern web apps
 
System insight without Interference
System insight without InterferenceSystem insight without Interference
System insight without Interference
 
Intro to node and mongodb 1
Intro to node and mongodb   1Intro to node and mongodb   1
Intro to node and mongodb 1
 
Kuby, ActiveDeployment for Rails Apps
Kuby, ActiveDeployment for Rails AppsKuby, ActiveDeployment for Rails Apps
Kuby, ActiveDeployment for Rails Apps
 
node.js: Javascript's in your backend
node.js: Javascript's in your backendnode.js: Javascript's in your backend
node.js: Javascript's in your backend
 
FITC - Node.js 101
FITC - Node.js 101FITC - Node.js 101
FITC - Node.js 101
 
Node azure
Node azureNode azure
Node azure
 
.NET Cloud-Native Bootcamp
.NET Cloud-Native Bootcamp.NET Cloud-Native Bootcamp
.NET Cloud-Native Bootcamp
 
用Serverless技術快速開發line聊天機器人
用Serverless技術快速開發line聊天機器人用Serverless技術快速開發line聊天機器人
用Serverless技術快速開發line聊天機器人
 
Get the EDGE to scale: Using Cloudfront along with edge compute to scale your...
Get the EDGE to scale: Using Cloudfront along with edge compute to scale your...Get the EDGE to scale: Using Cloudfront along with edge compute to scale your...
Get the EDGE to scale: Using Cloudfront along with edge compute to scale your...
 
Node.js - The New, New Hotness
Node.js - The New, New HotnessNode.js - The New, New Hotness
Node.js - The New, New Hotness
 
Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...
Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...
Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...
 
Orchestrating Docker with Terraform and Consul by Mitchell Hashimoto
Orchestrating Docker with Terraform and Consul by Mitchell Hashimoto Orchestrating Docker with Terraform and Consul by Mitchell Hashimoto
Orchestrating Docker with Terraform and Consul by Mitchell Hashimoto
 

More from Hendrik Ebbers

Vagrant Binding JayDay 2013
Vagrant Binding JayDay 2013Vagrant Binding JayDay 2013
Vagrant Binding JayDay 2013
Hendrik Ebbers
 

More from Hendrik Ebbers (20)

Java Desktop 2019
Java Desktop 2019Java Desktop 2019
Java Desktop 2019
 
Java APIs- The missing manual (concurrency)
Java APIs- The missing manual (concurrency)Java APIs- The missing manual (concurrency)
Java APIs- The missing manual (concurrency)
 
Beauty & the Beast - Java VS TypeScript
Beauty & the Beast - Java VS TypeScriptBeauty & the Beast - Java VS TypeScript
Beauty & the Beast - Java VS TypeScript
 
Java 11 OMG
Java 11 OMGJava 11 OMG
Java 11 OMG
 
Java APIs - the missing manual
Java APIs - the missing manualJava APIs - the missing manual
Java APIs - the missing manual
 
Multidevice Controls: A Different Approach to UX
Multidevice Controls: A Different Approach to UXMultidevice Controls: A Different Approach to UX
Multidevice Controls: A Different Approach to UX
 
Java WebStart Is Dead: What Should We Do Now?
Java WebStart Is Dead: What Should We Do Now?Java WebStart Is Dead: What Should We Do Now?
Java WebStart Is Dead: What Should We Do Now?
 
Java ap is you should know
Java ap is you should knowJava ap is you should know
Java ap is you should know
 
JavaFX JumpStart @JavaOne 2016
JavaFX JumpStart @JavaOne 2016JavaFX JumpStart @JavaOne 2016
JavaFX JumpStart @JavaOne 2016
 
BUILDING MODERN WEB UIS WITH WEB COMPONENTS @ Devoxx
BUILDING MODERN WEB UIS WITH WEB COMPONENTS @ DevoxxBUILDING MODERN WEB UIS WITH WEB COMPONENTS @ Devoxx
BUILDING MODERN WEB UIS WITH WEB COMPONENTS @ Devoxx
 
Web Components & Polymer 1.0 (Webinale Berlin)
Web Components & Polymer 1.0 (Webinale Berlin)Web Components & Polymer 1.0 (Webinale Berlin)
Web Components & Polymer 1.0 (Webinale Berlin)
 
webcomponents (Jfokus 2015)
webcomponents (Jfokus 2015)webcomponents (Jfokus 2015)
webcomponents (Jfokus 2015)
 
Test Driven Development with JavaFX
Test Driven Development with JavaFXTest Driven Development with JavaFX
Test Driven Development with JavaFX
 
JavaFX Enterprise (JavaOne 2014)
JavaFX Enterprise (JavaOne 2014)JavaFX Enterprise (JavaOne 2014)
JavaFX Enterprise (JavaOne 2014)
 
DataFX 8 (JavaOne 2014)
DataFX 8 (JavaOne 2014)DataFX 8 (JavaOne 2014)
DataFX 8 (JavaOne 2014)
 
Feature driven development
Feature driven developmentFeature driven development
Feature driven development
 
Extreme Gui Makeover
Extreme Gui MakeoverExtreme Gui Makeover
Extreme Gui Makeover
 
JavaFX Enterprise
JavaFX EnterpriseJavaFX Enterprise
JavaFX Enterprise
 
DataFX - JavaOne 2013
DataFX - JavaOne 2013DataFX - JavaOne 2013
DataFX - JavaOne 2013
 
Vagrant Binding JayDay 2013
Vagrant Binding JayDay 2013Vagrant Binding JayDay 2013
Vagrant Binding JayDay 2013
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
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
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
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
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 

Bonjour for Java

  • 2. Content • ZeroConf & Bonjour • AirPlay • Java API • Demos keep your fingers crossed for me
  • 3. HomeAutomationModule Welcome, please configure your Home Automation Server: IP-Adress Port ok Example Spooky, isn‘t it? ANTIPATTERN!!
  • 4. HomeAutomationModule Hi, please choose your Home Automation Server: ok HA Server living room (12.0.0.34:9001) My Server pool house (12.0.0.31:9001) This is how it goes Cool, isn‘t it?
  • 5. ZeroConf • methodology and set of special technologies • automatically create a usable computer network • assign numeric network addresses to devices • distribution and resolution of hostnames • location of network services
  • 6. Bonjour • Based on ZeroConf • provides a general method to discover services on a local area network • Used in many tools & applications • Open Source postgreSQL, Adobe Creative Suite, Skype ...
  • 7. Airplay • Default Services based on Bonjour • Stream Music, Movies & Photos from iOS to AppleTV • No configuration needed Find this icon on your iDevice User has time for other stuff
  • 8. Defining a Service • Each service has a type that is defined by a namespace • „_servicetype._tcp.local.“ • Each service has a name • Each service has a host and a port • Services can have descriptions and other properties
  • 9. • iOS Devices can stream Photos to AppleTV • Communication is based on Bonjour & REST • Find AirPlay Server with Bonjour • Send pictures with REST call Stream Photos REST call
  • 10. Stream Music • iOS Devices can stream Music to AppleTV • Same Workflow as with pictures • _airplay._tcp.local. • Communication is completely based on REST default service type for Airplay ... and documented in the web
  • 11. JmDNS • Java implementation of multi-cast DNS • fully compatible with Apple's Bonjour • provide simple ways for services to register themselves • discover multicast DNS based services http://jmdns.sourceforge.net
  • 12. Listen to a Service JmDNS jmDNS = JmDNS.create(); jmDNS.addServiceListener("name._tcp.local.", new ServiceListener() { @Override ! ! ! public void serviceAdded(ServiceEvent event) {...} ! ! ! @Override ! ! ! public void serviceResolved(ServiceEvent event) {...} ! ! ! @Override ! ! ! public void serviceRemoved(ServiceEvent event) {...} } ); create Context listener concept lifecylce wraps all infos
  • 13. Listen to a Service @Override public void serviceResolved(ServiceEvent event) { ! System.out.println("Type:" + event.getType()); ! System.out.println("Name:" + event.getName()); ! ! ! ! ! System.out.println("IP:" + event.getInfo().getHostAddress()); ! System.out.println("Port:" + event.getInfo().getPort()); ! System.out.println("Name:" + event.getInfo().getName()); ! System.out.println("Desc:" + event.getInfo().getNiceTextString()); ! System.out.println("Entry Point:" + event.getInfo().getURL()); } optional properties
  • 14. Create a Service JmDNS jmDNS = JmDNS.create(); ServiceInfo info = ServiceInfo.create("_demo1._tcp.local.", "Demo 1", 9090, "I‘m a demo"); jmDNS.registerService(info); create Context register on network type, name, port, description
  • 15. Example //Server RestServer server = new RestServer(); server.startMp3Player(„/play“, 9090); JmDNS jmDNS = JmDNS.create(); ServiceInfo info = ServiceInfo.create("playmp3._tcp.local.", "MP3 Player", 9090, "play a mp3 file"); jmDNS.registerService(info); //Client jmDNS.addServiceListener("playmp3._tcp.local.", new ServiceListener() { @Override ! ! ! public void serviceAdded(ServiceEvent event) { RestClient.play(„tuut.mp3“, event, „/play“); } }); create REST Server create DNS Service REST Call
  • 16. REST • Implement your services as REST WS • Client only needs to know the URL path • I usedVert.x You can use any REST API Cause it`s cool