SlideShare une entreprise Scribd logo
1  sur  28
Télécharger pour lire hors ligne
Academy #3
16th November 2015
Mickaël Rémond, @mickael
Questions
ejabberd questions
• How does Apple and Google Push support work on ejabberd SaaS and
ejabberd Business Edition ?
• What is the relationship between ejabberd Push support and XEP-0357:
Push Notifications ?
XMPP questions
• What is the impact of Websocket on Web chat performance ?
• What is the XMPP stack for quick prototyping ?
• Why do we seem to find duplicate in Message Archive Management
backend ?
What are Push Notifications and why do they matter ?
• Most smartphones Operating Systems are saving battery life by preventing
apps to run constantly and access network in background:
• On iOS, since iOS 3.
• On Android since Android 6.
• For a chat application, it means that:
• your application is suspended shortly after user put it to background.
• as a result you cannot directly receive messages.
=> You need an OS provider service that will awake your app when there is
message available for you on ejabberd.
Push service overview
Push service overview
Push app+device are identified with token
ejabberd
Push
ejabberd support for Push
• ejabberd SaaS and Business Edition natively support push notifications.
• Prerequisite for ejabberd configuration:
• iOS:
• App ID
• APNS sandbox and production certificates
• Android:
• Application package name
• API Key
• Prerequisite on client-side:
• iOS: Retrieve or update Device Token.
• Android: Retrieve or update Registration ID
ejabberd support for Push
• Client configuration is done with IQ stanza in the XMPP stream, after authentication.
<iq	type='set'	id='123'>	
	<push	xmlns='p1:push'	apn-sandbox='false'>	
		<keepalive	max="30"/>	
		<session	duration="60"/>	
		<body	send="all"	groupchat="true"	from="jid"/>	
		<status	type="xa">Text	Message	when	in	push	mode</status>	
		<offline>false</offline>	
		<notification>	
			<type>applepush</type>	
			<id>DeviceToken</id>	
		</notification>	
		<appid>application1</appid>	
	</push>	
</iq>
iOS notification sub elements
<iq	type='set'	id='123'>	
	<push	xmlns='p1:push'	apn-sandbox='false'>	
		<appid>AppID</appid>	
		<notification>	
			<type>applepush</type>	
			<id>DeviceToken</id>	
		</notification>	
		…	
	</push>	
</iq>
Android notification sub elements
<iq	type='set'	id='123'>	
	<push	xmlns='p1:push'	apn-sandbox='false'>	
		<appid>ApplicationPackageName</appid>	
		<notification>	
			<type>gcm</type>	
			<id>RegistrationID</id>	
		</notification>	
		…	
	</push>	
</iq>
ejabberd push triggers
• Message received while session is detached or user is offline.
• Groupchat messages while user session is running and possibly detached (optional)
• Badges: Automatic support for message counts. Auto reset on login.
Unread badge reset
<iq	type='set'	id='123'>	
		<badge	xmlns='p1:push'	unread='10'/>	
</iq>
Push setting customisations: Per sender sound
<iq	type="set"	id="cust1">	
		<customize	xmlns="p1:push:customize">	
				<item	from="adam@example.com"	mute="true"/>	
				<item	from="eve@example.com"	sound="horn.wav"/>	
		</customize>	
</iq>
Per message customisation
Custom fields in messages:
• This could allow clients to taylor rendering:
<message>	
...	
<x	xmlns="p1:push:custom"	key="AAA"	value="BBB">	
...	
</message>
Per message customisation
Per message sound customization:
<message	type="chat"	from="peer@example.com">	
		<body>Hello!</body>	
		<customize	xmlns="p1:push:customize"	sound="2.wav"/>	
</message>	
Or mute:
<message	type="chat"	from="peer@example.com">	
		<body>System	message:	...</body>	
		<customize	xmlns="p1:push:customize"	mute="true"/>	
</message>
Per message customisation
Customise body and nick displayed:
<message	type="chat"	from="peer@example.com">	
		<body>{matchResult:	"2:1",	Players:	[...]}</body>	
		<customize	xmlns="p1:push:customize"	nick="SportBot">	
				<body>Match	result	update	2:1	for	...</body>	
		</customize>	
</message>
Support for silent pushes
• Silent pushes are intended for the app only.
• They provide metadata for the app and can trigger background processing without displaying an alert
to the user.
• Useful to trigger background synchronisation when data are available.
Push Caveats
• Groupchat notifications are only possible when user is online or session is running on server in
detached mode.
• => We are adding feature to groupchat to dealt with that part.
• Apple Push buffer only contains one message:
• Do not expected to never miss a push: If your phone is turn off, you will only receive the latest
push when turned off.
• If this was a silent push, nothing will be visible to the user.
What is the relationship between ejabberd Push
support and XEP-0357: Push Notifications ?
• They cover different use cases:
• XEP-0357 defines:
• a way for app devices to pass their push credential to service.
• a standard API to trigger push notification from XMPP packets.
• XEP-0357 does not define the triggers:
• When and what the server is supposed to do to send push notifications to users.
• It assumes that it is mostly used by third-party services or component to send pushes.
• Our push approach fills the gap between:
• Server events that should trigger push notification, along with the format of such notifications.
• Actually sending the push to the device manufacturer push service.
What is the impact of Websocket on Web chat
performance ?
• On server, Websocket is a much more efficient protocol that takes less resources.
• However, impact on latency is directly visible on client.
Measurement of time to open session: Bosh vs
Websocket
• On server, Websocket is a much more efficient protocol that takes less resources.
• However, impact on latency is directly visible on client.
• Bosh (localhost, no SSL): 1428ms
• Websocket (localhost, no SSL): 307ms
• Bosh (remote server, SSL): 2198ms
• Websocket (remote server, SSL): 1446ms
• The more roundtrip you have, the more impact:
• Websocket is much better when there is a lot of interactions: Discovery, forms, server
configuration, etc.
What is the XMPP stack for quick prototyping ?
• Versatile and widely used server: ejabberd
• Client stack:
• Android: Smack 4
• iOS: XMPPFramework
• Web: Strophe
Using Strophe for prototyping / learning XMPP and
experimenting
• With a basic client, you can use the JS console to prepare and send XMPP packets:
presence = $pres();
connection.send(presence);
presence = $pres().c("status").t("away");
connection.send(presence);
message = $msg({to: "test@localhost", type: "chat"}).c("body").t("Hello
XMPP Academy !");
connection.send(message);
iq = $iq({to: "localhost", type: "get", id: "disco1"}).c("query", {xmlns:
"http://jabber.org/protocol/disco#info"});
connection.send(iq);
Why do we seem to find duplicate in Message Archive
Management backend ?
• When thinking about XMPP protocol, you need to think in federated context:
• Two XMPP domains can connect have have user chat between both domains.
• Message is stored once per user as archive can be managed independently (delete entry, etc)
Domain 1
Archive Archive
Domain 2User1 User2
See you at next

Contenu connexe

Tendances

NoSQL afternoon in Japan Kumofs & MessagePack
NoSQL afternoon in Japan Kumofs & MessagePackNoSQL afternoon in Japan Kumofs & MessagePack
NoSQL afternoon in Japan Kumofs & MessagePack
Sadayuki Furuhashi
 
Apache Kafka
Apache KafkaApache Kafka
Apache Kafka
Joe Stein
 

Tendances (20)

Fighting XMPP abuse and spam with ejabberd - ejabberd Workshop #1
Fighting XMPP abuse and spam with ejabberd - ejabberd Workshop #1Fighting XMPP abuse and spam with ejabberd - ejabberd Workshop #1
Fighting XMPP abuse and spam with ejabberd - ejabberd Workshop #1
 
Art Of Message Queues
Art Of Message QueuesArt Of Message Queues
Art Of Message Queues
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 
Apache Kafka
Apache KafkaApache Kafka
Apache Kafka
 
Practical solutions for connections administrators
Practical solutions for connections administratorsPractical solutions for connections administrators
Practical solutions for connections administrators
 
Noit ocon-2010
Noit ocon-2010Noit ocon-2010
Noit ocon-2010
 
Narayana 5: The premier open source transaction manager
Narayana 5: The premier open source transaction manager Narayana 5: The premier open source transaction manager
Narayana 5: The premier open source transaction manager
 
MNPHP Scalable Architecture 101 - Feb 3 2011
MNPHP Scalable Architecture 101 - Feb 3 2011MNPHP Scalable Architecture 101 - Feb 3 2011
MNPHP Scalable Architecture 101 - Feb 3 2011
 
Connections install in 45 mins
Connections install in 45 minsConnections install in 45 mins
Connections install in 45 mins
 
NoSQL afternoon in Japan Kumofs & MessagePack
NoSQL afternoon in Japan Kumofs & MessagePackNoSQL afternoon in Japan Kumofs & MessagePack
NoSQL afternoon in Japan Kumofs & MessagePack
 
HTTP - The Other Face Of Domino
HTTP - The Other Face Of DominoHTTP - The Other Face Of Domino
HTTP - The Other Face Of Domino
 
Apache James/Hupa & GWT
Apache James/Hupa & GWTApache James/Hupa & GWT
Apache James/Hupa & GWT
 
Apache Kafka
Apache KafkaApache Kafka
Apache Kafka
 
What's New in WildFly 9?
What's New in WildFly 9?What's New in WildFly 9?
What's New in WildFly 9?
 
Apache james more than emails in the cloud
Apache james  more than emails in the cloudApache james  more than emails in the cloud
Apache james more than emails in the cloud
 
Introduction to Kafka and Zookeeper
Introduction to Kafka and ZookeeperIntroduction to Kafka and Zookeeper
Introduction to Kafka and Zookeeper
 
Kafka Tutorial - basics of the Kafka streaming platform
Kafka Tutorial - basics of the Kafka streaming platformKafka Tutorial - basics of the Kafka streaming platform
Kafka Tutorial - basics of the Kafka streaming platform
 
Practical solutions for connections administrators lite
Practical solutions for connections administrators litePractical solutions for connections administrators lite
Practical solutions for connections administrators lite
 
Mule Script Transformer
Mule Script TransformerMule Script Transformer
Mule Script Transformer
 

Similaire à XMPP Academy #3

The Art of Message Queues - TEKX
The Art of Message Queues - TEKXThe Art of Message Queues - TEKX
The Art of Message Queues - TEKX
Mike Willbanks
 
Software Architectures, Week 4 - Message-based Architectures, Message Bus
Software Architectures, Week 4 - Message-based Architectures, Message BusSoftware Architectures, Week 4 - Message-based Architectures, Message Bus
Software Architectures, Week 4 - Message-based Architectures, Message Bus
Angelos Kapsimanis
 
Fronteers 20131205 the realtime web
Fronteers 20131205   the realtime webFronteers 20131205   the realtime web
Fronteers 20131205 the realtime web
Bert Wijnants
 

Similaire à XMPP Academy #3 (20)

The Real World - Plugging the Enterprise Into It (nodejs)
The Real World - Plugging  the Enterprise Into It (nodejs)The Real World - Plugging  the Enterprise Into It (nodejs)
The Real World - Plugging the Enterprise Into It (nodejs)
 
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
AD113  Speed Up Your Applications w/ Nginx and PageSpeedAD113  Speed Up Your Applications w/ Nginx and PageSpeed
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
 
Being HAPI! Reverse Proxying on Purpose
Being HAPI! Reverse Proxying on PurposeBeing HAPI! Reverse Proxying on Purpose
Being HAPI! Reverse Proxying on Purpose
 
The Art of Message Queues - TEKX
The Art of Message Queues - TEKXThe Art of Message Queues - TEKX
The Art of Message Queues - TEKX
 
3 Tips to Deliver Fast Performance Across Mobile Web
3 Tips to Deliver Fast Performance Across Mobile Web3 Tips to Deliver Fast Performance Across Mobile Web
3 Tips to Deliver Fast Performance Across Mobile Web
 
Software Architectures, Week 4 - Message-based Architectures, Message Bus
Software Architectures, Week 4 - Message-based Architectures, Message BusSoftware Architectures, Week 4 - Message-based Architectures, Message Bus
Software Architectures, Week 4 - Message-based Architectures, Message Bus
 
2nd AMIMOTO: WordPress + Amazon Web Services Singapore
2nd AMIMOTO: WordPress + Amazon Web Services Singapore2nd AMIMOTO: WordPress + Amazon Web Services Singapore
2nd AMIMOTO: WordPress + Amazon Web Services Singapore
 
AWS re:Invent 2016: Amazon CloudFront Flash Talks: Best Practices on Configur...
AWS re:Invent 2016: Amazon CloudFront Flash Talks: Best Practices on Configur...AWS re:Invent 2016: Amazon CloudFront Flash Talks: Best Practices on Configur...
AWS re:Invent 2016: Amazon CloudFront Flash Talks: Best Practices on Configur...
 
Signal R 2015
Signal R 2015Signal R 2015
Signal R 2015
 
Why we choose Symfony2
Why we choose Symfony2Why we choose Symfony2
Why we choose Symfony2
 
Silverlight vs HTML5 - Lessons learned from the real world...
Silverlight vs HTML5 - Lessons learned from the real world...Silverlight vs HTML5 - Lessons learned from the real world...
Silverlight vs HTML5 - Lessons learned from the real world...
 
Fronteers 20131205 the realtime web
Fronteers 20131205   the realtime webFronteers 20131205   the realtime web
Fronteers 20131205 the realtime web
 
Writing a Fullstack Application with Javascript - Remote media player
Writing a Fullstack Application with Javascript - Remote media playerWriting a Fullstack Application with Javascript - Remote media player
Writing a Fullstack Application with Javascript - Remote media player
 
Iphone client-server app with Rails backend (v3)
Iphone client-server app with Rails backend (v3)Iphone client-server app with Rails backend (v3)
Iphone client-server app with Rails backend (v3)
 
IoT with SignalR & .NET Gadgeteer - NetMF@Work
IoT with SignalR & .NET Gadgeteer - NetMF@WorkIoT with SignalR & .NET Gadgeteer - NetMF@Work
IoT with SignalR & .NET Gadgeteer - NetMF@Work
 
Monitoring and tuning your chef server - chef conf talk
Monitoring and tuning your chef server - chef conf talk Monitoring and tuning your chef server - chef conf talk
Monitoring and tuning your chef server - chef conf talk
 
AMIMOTO: WordPress + Amazon Web Services University of the Philippines Los Baños
AMIMOTO: WordPress + Amazon Web Services University of the Philippines Los BañosAMIMOTO: WordPress + Amazon Web Services University of the Philippines Los Baños
AMIMOTO: WordPress + Amazon Web Services University of the Philippines Los Baños
 
Advanced nginx in mercari - How to handle over 1,200,000 HTTPS Reqs/Min
Advanced nginx in mercari - How to handle over 1,200,000 HTTPS Reqs/MinAdvanced nginx in mercari - How to handle over 1,200,000 HTTPS Reqs/Min
Advanced nginx in mercari - How to handle over 1,200,000 HTTPS Reqs/Min
 
presentation slides
presentation slidespresentation slides
presentation slides
 
Real-World Pulsar Architectural Patterns
Real-World Pulsar Architectural PatternsReal-World Pulsar Architectural Patterns
Real-World Pulsar Architectural Patterns
 

Plus de Mickaël Rémond

Plus de Mickaël Rémond (14)

Go for Real Time Streaming Architectures - DotGo 2017
Go for Real Time Streaming Architectures - DotGo 2017Go for Real Time Streaming Architectures - DotGo 2017
Go for Real Time Streaming Architectures - DotGo 2017
 
Phoenix Presence: Le service temps réel de Phoenix - Paris.ex #8
Phoenix Presence: Le service temps réel de Phoenix - Paris.ex #8 Phoenix Presence: Le service temps réel de Phoenix - Paris.ex #8
Phoenix Presence: Le service temps réel de Phoenix - Paris.ex #8
 
Messaging temps réel avec Go
Messaging temps réel avec GoMessaging temps réel avec Go
Messaging temps réel avec Go
 
Building Scalable Systems: What you can learn from Erlang - DotScale 2016
Building Scalable Systems: What you can learn from Erlang - DotScale 2016Building Scalable Systems: What you can learn from Erlang - DotScale 2016
Building Scalable Systems: What you can learn from Erlang - DotScale 2016
 
Property-based testing of XMPP: generate your tests automatically - ejabberd ...
Property-based testing of XMPP: generate your tests automatically - ejabberd ...Property-based testing of XMPP: generate your tests automatically - ejabberd ...
Property-based testing of XMPP: generate your tests automatically - ejabberd ...
 
Deep Dive Into ejabberd Pubsub Implementation
Deep Dive Into ejabberd Pubsub ImplementationDeep Dive Into ejabberd Pubsub Implementation
Deep Dive Into ejabberd Pubsub Implementation
 
2015: L'année d'Elixir, Code, écosystème et communauté
2015: L'année d'Elixir, Code, écosystème et communauté2015: L'année d'Elixir, Code, écosystème et communauté
2015: L'année d'Elixir, Code, écosystème et communauté
 
Multitasking in iOS 7
Multitasking in iOS 7Multitasking in iOS 7
Multitasking in iOS 7
 
WaveOne server and client by ProcessOne
WaveOne server and client by ProcessOneWaveOne server and client by ProcessOne
WaveOne server and client by ProcessOne
 
Real time Web Application with XMPP and Wave
Real time Web Application with XMPP and WaveReal time Web Application with XMPP and Wave
Real time Web Application with XMPP and Wave
 
Erlang White Label
Erlang White LabelErlang White Label
Erlang White Label
 
OneTeam Media Server
OneTeam Media ServerOneTeam Media Server
OneTeam Media Server
 
OneTeam Media Server
OneTeam Media ServerOneTeam Media Server
OneTeam Media Server
 
Real life XMPP Instant Messaging
Real life XMPP Instant MessagingReal life XMPP Instant Messaging
Real life XMPP Instant Messaging
 

Dernier

+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
 

Dernier (20)

+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...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
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
 
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, ...
 
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
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
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
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
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...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
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...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
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
 
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
 
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
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 

XMPP Academy #3

  • 1. Academy #3 16th November 2015 Mickaël Rémond, @mickael
  • 2. Questions ejabberd questions • How does Apple and Google Push support work on ejabberd SaaS and ejabberd Business Edition ? • What is the relationship between ejabberd Push support and XEP-0357: Push Notifications ? XMPP questions • What is the impact of Websocket on Web chat performance ? • What is the XMPP stack for quick prototyping ? • Why do we seem to find duplicate in Message Archive Management backend ?
  • 3. What are Push Notifications and why do they matter ? • Most smartphones Operating Systems are saving battery life by preventing apps to run constantly and access network in background: • On iOS, since iOS 3. • On Android since Android 6. • For a chat application, it means that: • your application is suspended shortly after user put it to background. • as a result you cannot directly receive messages. => You need an OS provider service that will awake your app when there is message available for you on ejabberd.
  • 6. Push app+device are identified with token ejabberd Push
  • 7. ejabberd support for Push • ejabberd SaaS and Business Edition natively support push notifications. • Prerequisite for ejabberd configuration: • iOS: • App ID • APNS sandbox and production certificates • Android: • Application package name • API Key • Prerequisite on client-side: • iOS: Retrieve or update Device Token. • Android: Retrieve or update Registration ID
  • 8. ejabberd support for Push • Client configuration is done with IQ stanza in the XMPP stream, after authentication. <iq type='set' id='123'> <push xmlns='p1:push' apn-sandbox='false'> <keepalive max="30"/> <session duration="60"/> <body send="all" groupchat="true" from="jid"/> <status type="xa">Text Message when in push mode</status> <offline>false</offline> <notification> <type>applepush</type> <id>DeviceToken</id> </notification> <appid>application1</appid> </push> </iq>
  • 9. iOS notification sub elements <iq type='set' id='123'> <push xmlns='p1:push' apn-sandbox='false'> <appid>AppID</appid> <notification> <type>applepush</type> <id>DeviceToken</id> </notification> … </push> </iq>
  • 10. Android notification sub elements <iq type='set' id='123'> <push xmlns='p1:push' apn-sandbox='false'> <appid>ApplicationPackageName</appid> <notification> <type>gcm</type> <id>RegistrationID</id> </notification> … </push> </iq>
  • 11. ejabberd push triggers • Message received while session is detached or user is offline. • Groupchat messages while user session is running and possibly detached (optional) • Badges: Automatic support for message counts. Auto reset on login.
  • 13. Push setting customisations: Per sender sound <iq type="set" id="cust1"> <customize xmlns="p1:push:customize"> <item from="adam@example.com" mute="true"/> <item from="eve@example.com" sound="horn.wav"/> </customize> </iq>
  • 14. Per message customisation Custom fields in messages: • This could allow clients to taylor rendering: <message> ... <x xmlns="p1:push:custom" key="AAA" value="BBB"> ... </message>
  • 15. Per message customisation Per message sound customization: <message type="chat" from="peer@example.com"> <body>Hello!</body> <customize xmlns="p1:push:customize" sound="2.wav"/> </message> Or mute: <message type="chat" from="peer@example.com"> <body>System message: ...</body> <customize xmlns="p1:push:customize" mute="true"/> </message>
  • 16. Per message customisation Customise body and nick displayed: <message type="chat" from="peer@example.com"> <body>{matchResult: "2:1", Players: [...]}</body> <customize xmlns="p1:push:customize" nick="SportBot"> <body>Match result update 2:1 for ...</body> </customize> </message>
  • 17. Support for silent pushes • Silent pushes are intended for the app only. • They provide metadata for the app and can trigger background processing without displaying an alert to the user. • Useful to trigger background synchronisation when data are available.
  • 18. Push Caveats • Groupchat notifications are only possible when user is online or session is running on server in detached mode. • => We are adding feature to groupchat to dealt with that part. • Apple Push buffer only contains one message: • Do not expected to never miss a push: If your phone is turn off, you will only receive the latest push when turned off. • If this was a silent push, nothing will be visible to the user.
  • 19. What is the relationship between ejabberd Push support and XEP-0357: Push Notifications ? • They cover different use cases: • XEP-0357 defines: • a way for app devices to pass their push credential to service. • a standard API to trigger push notification from XMPP packets. • XEP-0357 does not define the triggers: • When and what the server is supposed to do to send push notifications to users. • It assumes that it is mostly used by third-party services or component to send pushes. • Our push approach fills the gap between: • Server events that should trigger push notification, along with the format of such notifications. • Actually sending the push to the device manufacturer push service.
  • 20. What is the impact of Websocket on Web chat performance ? • On server, Websocket is a much more efficient protocol that takes less resources. • However, impact on latency is directly visible on client.
  • 21.
  • 22. Measurement of time to open session: Bosh vs Websocket • On server, Websocket is a much more efficient protocol that takes less resources. • However, impact on latency is directly visible on client. • Bosh (localhost, no SSL): 1428ms • Websocket (localhost, no SSL): 307ms • Bosh (remote server, SSL): 2198ms • Websocket (remote server, SSL): 1446ms • The more roundtrip you have, the more impact: • Websocket is much better when there is a lot of interactions: Discovery, forms, server configuration, etc.
  • 23. What is the XMPP stack for quick prototyping ? • Versatile and widely used server: ejabberd • Client stack: • Android: Smack 4 • iOS: XMPPFramework • Web: Strophe
  • 24. Using Strophe for prototyping / learning XMPP and experimenting • With a basic client, you can use the JS console to prepare and send XMPP packets: presence = $pres(); connection.send(presence); presence = $pres().c("status").t("away"); connection.send(presence); message = $msg({to: "test@localhost", type: "chat"}).c("body").t("Hello XMPP Academy !"); connection.send(message); iq = $iq({to: "localhost", type: "get", id: "disco1"}).c("query", {xmlns: "http://jabber.org/protocol/disco#info"}); connection.send(iq);
  • 25.
  • 26. Why do we seem to find duplicate in Message Archive Management backend ? • When thinking about XMPP protocol, you need to think in federated context: • Two XMPP domains can connect have have user chat between both domains. • Message is stored once per user as archive can be managed independently (delete entry, etc)
  • 28. See you at next