SlideShare ist ein Scribd-Unternehmen logo
1 von 14
Scalable Real Time Chat (Text, Audio, Video)
Implemented using XMPP
Scaling Series
Topics
1. RTA and their Applications
- A few examples
2. Introduction to XMPP & Ejabberd
- What is XMPP? Why we use XMPP? What is ejabberd?
3. Chat Over XMPP
- Some features
4. Dynamic Notifications
- How we send dynamic notification about recently created activities?
5. Specs implemented for Audio/Video calls
- Calls in multiple tabs, Call functionality For Safari using Temasys plugin.
6. Problems Faced
- Problems faced while implementing Audio/Video calls.
7. Future Implementations
- Some chat/call related enhancements/features
A real time application(RTA) is an application functions within a time frame, generally measured in the order of milliseconds or
sometimes microseconds. Some examples of RTAs are :
 Video conferencing
 Voice calls
 Online gaming
 Chatting
 IM (instant messaging)
 Some e-commerce transactions
Ways to build RTAs : https://www.youtube.com/watch?v=ZwyjDiikNKk
RTA and their Applications
XMPP (Extensible Messaging and Presence Protocol) is a protocol based on Extensible Markup Language (XML) and intended for
instant messaging (IM) and online presence detection. The protocol eventually allows Internet users to send instant messages to
anyone else on the Internet, regardless of differences in operating systems and browsers. XMPP has 3 fundamental stanzas:
<presence>, <message> and <iq>
More Details At:- http://www.adarshr.com/fun-with-xmpp-and-google-talk-part-2
An alternative for XMPP was socket.io (http://socket.io/) that had scalability issues
Introduction to XMPP and Ejabberd
Ejabberd is a Rock Solid, Massively Scalable, Infinitely Extensible XMPP Server - https://www.ejabberd.im/. Some
alternative that we considered to choose from was Openfire and Prosody.
Following are the advantages that Ejabberd provides over Openfire and Prosody:
 Low CPU consumption
 Stability: Server keeps running for other users, irrespective of problems like client system crashed or program has bugs
 Clustering support: Install ejabberd in several machines and set them up as clusters to spread excess load, hence more scalable.
 Simple WebAdmin console for managing users, modules, etc.
 Uses Erlang which is much faster than Java used by Openfire and Lua used by Prosody. (Erlang vs Lua
http://vschart.com/compare/lua/vs/erlang-programming-language)
Introduction to XMPP and Ejabberd
Before we start communicating we need to have a session opened between the client and the chat server (ejabberd). For this we use
WebSocket connection. WebSocket allows us to create a Full-Duplex communication channel with very less data overhead and
complexity.
To implement chat over XMPP we use JSJaC - https://github.com/sstrigler/JSJaC. It provides support for communicating with Jabber
server(ejabberd) using XMPP Over WebSocket. Once a WebSocket connection is created, we can start sending the JsJaC messages
using the connection object. An example is as follows:
con = new JSJaCWebSocketConnection({ httpbase: ‘wss://devtalent01.exphosted.com:5280/websocket’ });
con.connect({
username: ‘performance-1’,
domain: ‘uklocal.com’,
resource: ‘performance_12345678’,
pass: ‘password’,
secure: true
});
var oMsg = new JSJaCMessage();
oMsg.setTo(new JSJaCJID(receivers_jid));
oMsg.setBody(message_body);
con.send(oMsg);
Chat over XMPP
Features that we implemented for chat :
 User online indicators.
 User typing indicator.
 Chat over multiple tabs and browsers with different resources (marking as read if it’s read in any tab)
 Highlighting and Bounce indicator if respective chat review assignment is not in viewport (stopping bounce of a particular chat
count)
 Splash notification (missed chat functionality)
 Opening form and viewing chat inside the form on clicking the splash notification
 Chat history using Store.js (https://github.com/marcuswestin/store.js/) (! IE)
Chat over XMPP
Dynamic Notifications
To implement dynamic notification we have used XMPP4R (https://xmpp4r.github.io/). XMPP4R is nothing but a XMPP/Jabber library
for Ruby.
Sample Code:
Check self.send_push_notification(activity_id, recipient_jids) in User.rb for push notification implementation. This is also used for
notifying other users if profile pic was changed or Task was cancelled.
Specs for Audio/Video Calls
We use giggleJS(https://github.com/valeriansaliou/giggle) for audio/video calls.
An alternative for this is Strophe.jingle(https://github.com/ESTOS/strophe.jingle) for Strophe.js
 Following are the features that we support with calls:
 Multiple Tabs and Browsers (Upto 10 tabs)
 Missed call notification
 User busy and hardware detection feature
 Call is retained even when switching between pages
 Viewing respective Task form while in a call
 Muting/Unmuting audio or video
 Draggable call window, full screen interaction
 Call support for Safari using Temasys Plugin and Adapter JS (https://temasys.atlassian.net/wiki/display/TWPP/WebRTC+Plugins)
Specs for Audio/Video Calls
WebRTC : GiggleJS uses WebRTC API for establishing a peer to peer connection. Some native APIs of WebRTC are:
Changes made for Audio/Video calls in Safari can be found in our wiki:
https://wiki.exphosted.com/doku.php/audio_video_calls_over_xmpp
 getUserMedia
 RTCPeerConnection
 RTCSessionDescription
 RTCIceCandidate
Problems Faced
 Multiple notification issues.
 Chat history for new browser but same user login
 Handling chat count in multiple tabs/browsers
 Showing when receiver is busy (multiple tabs)
 Blocking other calls if one call is active from either end
 Logging out user from CHAT if he/she has logged out in other tab
 Stop hardware usage after call has ended.
Future Implementations
 Screen sharing using giggle.js
 Group chat/calls
 Call history
Reference Links
 XMPP and WebSocket - http://stackoverflow.com/a/26560860, https://blog.andyet.com/2014/10/30/websocket/
 XMPP over Socket.io - http://stackoverflow.com/a/33868081
 Jingle - http://xmpp.org/extensions/xep-0166.pdf
 XMPP fundamental stanza examples - http://xmpp.org/rfcs/rfc3921.html#stanzas-presence-children-show
 BOSH vs WebSockets - http://stackoverflow.com/a/6442488
 XMPP and WebRTC - https://xmpp.org/uses/webrtc.html
 Lua vs Erlang - http://vschart.com/compare/lua/vs/erlang-programming-language
THANK YOU

Weitere ähnliche Inhalte

Was ist angesagt?

Advanced java
Advanced java Advanced java
Advanced java NA
 
JRuby and Google App Engine
JRuby and Google App EngineJRuby and Google App Engine
JRuby and Google App Enginejoshsmoore
 
Performance tips for Symfony2 & PHP
Performance tips for Symfony2 & PHPPerformance tips for Symfony2 & PHP
Performance tips for Symfony2 & PHPMax Romanovsky
 
Introduction to Apache Maven
Introduction to Apache MavenIntroduction to Apache Maven
Introduction to Apache MavenRajind Ruparathna
 
Single Sourcing RAP and RCP - Desktop and web clients from a single code base
Single Sourcing RAP and RCP - Desktop and web clients from a single code baseSingle Sourcing RAP and RCP - Desktop and web clients from a single code base
Single Sourcing RAP and RCP - Desktop and web clients from a single code baseRalf Sternberg
 
Springboot introduction
Springboot introductionSpringboot introduction
Springboot introductionSagar Verma
 
Angular + JHipster - JHipster Conf
Angular + JHipster - JHipster ConfAngular + JHipster - JHipster Conf
Angular + JHipster - JHipster ConfWilliam Marques
 
eXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework IntroductioneXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework Introductionvstorm83
 
An Introduction to Maven Part 1
An Introduction to Maven Part 1An Introduction to Maven Part 1
An Introduction to Maven Part 1MD Sayem Ahmed
 
Single Sourcing RCP and RAP
Single Sourcing RCP and RAPSingle Sourcing RCP and RAP
Single Sourcing RCP and RAPChris Aniszczyk
 
Java Builds with Maven and Ant
Java Builds with Maven and AntJava Builds with Maven and Ant
Java Builds with Maven and AntDavid Noble
 
Polyglot Applications with GraalVM
Polyglot Applications with GraalVMPolyglot Applications with GraalVM
Polyglot Applications with GraalVMjexp
 

Was ist angesagt? (20)

Advanced java
Advanced java Advanced java
Advanced java
 
JRuby and Google App Engine
JRuby and Google App EngineJRuby and Google App Engine
JRuby and Google App Engine
 
JavaCro'15 - Reactive I/O - Ivan Turčinović
JavaCro'15 - Reactive I/O - Ivan TurčinovićJavaCro'15 - Reactive I/O - Ivan Turčinović
JavaCro'15 - Reactive I/O - Ivan Turčinović
 
Phalcon 2 - PHP Brazil Conference
Phalcon 2 - PHP Brazil ConferencePhalcon 2 - PHP Brazil Conference
Phalcon 2 - PHP Brazil Conference
 
Performance tips for Symfony2 & PHP
Performance tips for Symfony2 & PHPPerformance tips for Symfony2 & PHP
Performance tips for Symfony2 & PHP
 
Os Bubna
Os BubnaOs Bubna
Os Bubna
 
Introduction to Apache Maven
Introduction to Apache MavenIntroduction to Apache Maven
Introduction to Apache Maven
 
Single Sourcing RAP and RCP - Desktop and web clients from a single code base
Single Sourcing RAP and RCP - Desktop and web clients from a single code baseSingle Sourcing RAP and RCP - Desktop and web clients from a single code base
Single Sourcing RAP and RCP - Desktop and web clients from a single code base
 
Springboot introduction
Springboot introductionSpringboot introduction
Springboot introduction
 
TorqueBox
TorqueBoxTorqueBox
TorqueBox
 
Angular + JHipster - JHipster Conf
Angular + JHipster - JHipster ConfAngular + JHipster - JHipster Conf
Angular + JHipster - JHipster Conf
 
eXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework IntroductioneXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework Introduction
 
Jvm
JvmJvm
Jvm
 
An Introduction to Maven Part 1
An Introduction to Maven Part 1An Introduction to Maven Part 1
An Introduction to Maven Part 1
 
Single Sourcing RCP and RAP
Single Sourcing RCP and RAPSingle Sourcing RCP and RAP
Single Sourcing RCP and RAP
 
Introduction to Maven
Introduction to MavenIntroduction to Maven
Introduction to Maven
 
java new technology
java new technologyjava new technology
java new technology
 
Java Builds with Maven and Ant
Java Builds with Maven and AntJava Builds with Maven and Ant
Java Builds with Maven and Ant
 
Polyglot Applications with GraalVM
Polyglot Applications with GraalVMPolyglot Applications with GraalVM
Polyglot Applications with GraalVM
 
Maven tutorial for beginners
Maven tutorial for beginnersMaven tutorial for beginners
Maven tutorial for beginners
 

Ähnlich wie Scalable Real Time Chat (Text, Audio, Video) - Implemented using XMPP

SignalR Intro + WPDev
SignalR Intro + WPDevSignalR Intro + WPDev
SignalR Intro + WPDevSam Basu
 
The Art of Message Queues - TEKX
The Art of Message Queues - TEKXThe Art of Message Queues - TEKX
The Art of Message Queues - TEKXMike Willbanks
 
Leveraging BlazeDS, Java, and Flex: Dynamic Data Transfer
Leveraging BlazeDS, Java, and Flex: Dynamic Data TransferLeveraging BlazeDS, Java, and Flex: Dynamic Data Transfer
Leveraging BlazeDS, Java, and Flex: Dynamic Data TransferJoseph Labrecque
 
Eyeball Messenger SDK WebRTC Developer Reference Guide
Eyeball Messenger SDK WebRTC Developer Reference GuideEyeball Messenger SDK WebRTC Developer Reference Guide
Eyeball Messenger SDK WebRTC Developer Reference GuideEyeball Networks
 
Web Server-Side Programming Techniques
Web Server-Side Programming TechniquesWeb Server-Side Programming Techniques
Web Server-Side Programming Techniquesguest8899ec02
 
Java script anywhere. What Nombas was doing pre-acquisition.
Java script anywhere. What Nombas was doing pre-acquisition.Java script anywhere. What Nombas was doing pre-acquisition.
Java script anywhere. What Nombas was doing pre-acquisition.Brent Noorda
 
SignalR + Mobile Possibilities
SignalR + Mobile PossibilitiesSignalR + Mobile Possibilities
SignalR + Mobile PossibilitiesSam Basu
 
A vision for ejabberd - ejabberd SF Meetup
A vision for ejabberd - ejabberd SF MeetupA vision for ejabberd - ejabberd SF Meetup
A vision for ejabberd - ejabberd SF MeetupMickaël Rémond
 
Tuenti teams - Php Conference
Tuenti teams - Php ConferenceTuenti teams - Php Conference
Tuenti teams - Php ConferenceGuille -bisho-
 
HTML5 - The Python Angle (PyCon Ireland 2010)
HTML5 - The Python Angle (PyCon Ireland 2010)HTML5 - The Python Angle (PyCon Ireland 2010)
HTML5 - The Python Angle (PyCon Ireland 2010)Kevin Gill
 
Online test management system
Online test management systemOnline test management system
Online test management systemPrateek Agarwak
 
Building scalable and language-independent Java services using Apache Thrift ...
Building scalable and language-independent Java services using Apache Thrift ...Building scalable and language-independent Java services using Apache Thrift ...
Building scalable and language-independent Java services using Apache Thrift ...IndicThreads
 
Project report for final year project
Project report for final year projectProject report for final year project
Project report for final year projectsuneel singh
 
Intro to Perfect - LA presentation
Intro to Perfect - LA presentationIntro to Perfect - LA presentation
Intro to Perfect - LA presentationTim Taplin
 

Ähnlich wie Scalable Real Time Chat (Text, Audio, Video) - Implemented using XMPP (20)

SignalR Intro + WPDev
SignalR Intro + WPDevSignalR Intro + WPDev
SignalR Intro + WPDev
 
The Art of Message Queues - TEKX
The Art of Message Queues - TEKXThe Art of Message Queues - TEKX
The Art of Message Queues - TEKX
 
Leveraging BlazeDS, Java, and Flex: Dynamic Data Transfer
Leveraging BlazeDS, Java, and Flex: Dynamic Data TransferLeveraging BlazeDS, Java, and Flex: Dynamic Data Transfer
Leveraging BlazeDS, Java, and Flex: Dynamic Data Transfer
 
Webrtc in Real world
Webrtc in Real world Webrtc in Real world
Webrtc in Real world
 
Eyeball Messenger SDK WebRTC Developer Reference Guide
Eyeball Messenger SDK WebRTC Developer Reference GuideEyeball Messenger SDK WebRTC Developer Reference Guide
Eyeball Messenger SDK WebRTC Developer Reference Guide
 
Web Server-Side Programming Techniques
Web Server-Side Programming TechniquesWeb Server-Side Programming Techniques
Web Server-Side Programming Techniques
 
Java script anywhere. What Nombas was doing pre-acquisition.
Java script anywhere. What Nombas was doing pre-acquisition.Java script anywhere. What Nombas was doing pre-acquisition.
Java script anywhere. What Nombas was doing pre-acquisition.
 
SignalR + Mobile Possibilities
SignalR + Mobile PossibilitiesSignalR + Mobile Possibilities
SignalR + Mobile Possibilities
 
Communicating System
Communicating SystemCommunicating System
Communicating System
 
A vision for ejabberd - ejabberd SF Meetup
A vision for ejabberd - ejabberd SF MeetupA vision for ejabberd - ejabberd SF Meetup
A vision for ejabberd - ejabberd SF Meetup
 
Xmpp and java
Xmpp and javaXmpp and java
Xmpp and java
 
Tuenti teams - Php Conference
Tuenti teams - Php ConferenceTuenti teams - Php Conference
Tuenti teams - Php Conference
 
HTML5 - The Python Angle (PyCon Ireland 2010)
HTML5 - The Python Angle (PyCon Ireland 2010)HTML5 - The Python Angle (PyCon Ireland 2010)
HTML5 - The Python Angle (PyCon Ireland 2010)
 
Streaming in grails
Streaming in grailsStreaming in grails
Streaming in grails
 
Online test management system
Online test management systemOnline test management system
Online test management system
 
Servlet by Rj
Servlet by RjServlet by Rj
Servlet by Rj
 
Building scalable and language-independent Java services using Apache Thrift ...
Building scalable and language-independent Java services using Apache Thrift ...Building scalable and language-independent Java services using Apache Thrift ...
Building scalable and language-independent Java services using Apache Thrift ...
 
Project report for final year project
Project report for final year projectProject report for final year project
Project report for final year project
 
Rest overview briefing
Rest  overview briefingRest  overview briefing
Rest overview briefing
 
Intro to Perfect - LA presentation
Intro to Perfect - LA presentationIntro to Perfect - LA presentation
Intro to Perfect - LA presentation
 

Kürzlich hochgeladen

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 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
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
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...Drew Madelung
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
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
 
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
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
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...Neo4j
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
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
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
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
 

Kürzlich hochgeladen (20)

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 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
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
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...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
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
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
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...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
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
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
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
 

Scalable Real Time Chat (Text, Audio, Video) - Implemented using XMPP

  • 1. Scalable Real Time Chat (Text, Audio, Video) Implemented using XMPP Scaling Series
  • 2. Topics 1. RTA and their Applications - A few examples 2. Introduction to XMPP & Ejabberd - What is XMPP? Why we use XMPP? What is ejabberd? 3. Chat Over XMPP - Some features 4. Dynamic Notifications - How we send dynamic notification about recently created activities? 5. Specs implemented for Audio/Video calls - Calls in multiple tabs, Call functionality For Safari using Temasys plugin. 6. Problems Faced - Problems faced while implementing Audio/Video calls. 7. Future Implementations - Some chat/call related enhancements/features
  • 3. A real time application(RTA) is an application functions within a time frame, generally measured in the order of milliseconds or sometimes microseconds. Some examples of RTAs are :  Video conferencing  Voice calls  Online gaming  Chatting  IM (instant messaging)  Some e-commerce transactions Ways to build RTAs : https://www.youtube.com/watch?v=ZwyjDiikNKk RTA and their Applications
  • 4. XMPP (Extensible Messaging and Presence Protocol) is a protocol based on Extensible Markup Language (XML) and intended for instant messaging (IM) and online presence detection. The protocol eventually allows Internet users to send instant messages to anyone else on the Internet, regardless of differences in operating systems and browsers. XMPP has 3 fundamental stanzas: <presence>, <message> and <iq> More Details At:- http://www.adarshr.com/fun-with-xmpp-and-google-talk-part-2 An alternative for XMPP was socket.io (http://socket.io/) that had scalability issues Introduction to XMPP and Ejabberd
  • 5. Ejabberd is a Rock Solid, Massively Scalable, Infinitely Extensible XMPP Server - https://www.ejabberd.im/. Some alternative that we considered to choose from was Openfire and Prosody. Following are the advantages that Ejabberd provides over Openfire and Prosody:  Low CPU consumption  Stability: Server keeps running for other users, irrespective of problems like client system crashed or program has bugs  Clustering support: Install ejabberd in several machines and set them up as clusters to spread excess load, hence more scalable.  Simple WebAdmin console for managing users, modules, etc.  Uses Erlang which is much faster than Java used by Openfire and Lua used by Prosody. (Erlang vs Lua http://vschart.com/compare/lua/vs/erlang-programming-language) Introduction to XMPP and Ejabberd
  • 6. Before we start communicating we need to have a session opened between the client and the chat server (ejabberd). For this we use WebSocket connection. WebSocket allows us to create a Full-Duplex communication channel with very less data overhead and complexity. To implement chat over XMPP we use JSJaC - https://github.com/sstrigler/JSJaC. It provides support for communicating with Jabber server(ejabberd) using XMPP Over WebSocket. Once a WebSocket connection is created, we can start sending the JsJaC messages using the connection object. An example is as follows: con = new JSJaCWebSocketConnection({ httpbase: ‘wss://devtalent01.exphosted.com:5280/websocket’ }); con.connect({ username: ‘performance-1’, domain: ‘uklocal.com’, resource: ‘performance_12345678’, pass: ‘password’, secure: true }); var oMsg = new JSJaCMessage(); oMsg.setTo(new JSJaCJID(receivers_jid)); oMsg.setBody(message_body); con.send(oMsg); Chat over XMPP
  • 7. Features that we implemented for chat :  User online indicators.  User typing indicator.  Chat over multiple tabs and browsers with different resources (marking as read if it’s read in any tab)  Highlighting and Bounce indicator if respective chat review assignment is not in viewport (stopping bounce of a particular chat count)  Splash notification (missed chat functionality)  Opening form and viewing chat inside the form on clicking the splash notification  Chat history using Store.js (https://github.com/marcuswestin/store.js/) (! IE) Chat over XMPP
  • 8. Dynamic Notifications To implement dynamic notification we have used XMPP4R (https://xmpp4r.github.io/). XMPP4R is nothing but a XMPP/Jabber library for Ruby. Sample Code: Check self.send_push_notification(activity_id, recipient_jids) in User.rb for push notification implementation. This is also used for notifying other users if profile pic was changed or Task was cancelled.
  • 9. Specs for Audio/Video Calls We use giggleJS(https://github.com/valeriansaliou/giggle) for audio/video calls. An alternative for this is Strophe.jingle(https://github.com/ESTOS/strophe.jingle) for Strophe.js  Following are the features that we support with calls:  Multiple Tabs and Browsers (Upto 10 tabs)  Missed call notification  User busy and hardware detection feature  Call is retained even when switching between pages  Viewing respective Task form while in a call  Muting/Unmuting audio or video  Draggable call window, full screen interaction  Call support for Safari using Temasys Plugin and Adapter JS (https://temasys.atlassian.net/wiki/display/TWPP/WebRTC+Plugins)
  • 10. Specs for Audio/Video Calls WebRTC : GiggleJS uses WebRTC API for establishing a peer to peer connection. Some native APIs of WebRTC are: Changes made for Audio/Video calls in Safari can be found in our wiki: https://wiki.exphosted.com/doku.php/audio_video_calls_over_xmpp  getUserMedia  RTCPeerConnection  RTCSessionDescription  RTCIceCandidate
  • 11. Problems Faced  Multiple notification issues.  Chat history for new browser but same user login  Handling chat count in multiple tabs/browsers  Showing when receiver is busy (multiple tabs)  Blocking other calls if one call is active from either end  Logging out user from CHAT if he/she has logged out in other tab  Stop hardware usage after call has ended.
  • 12. Future Implementations  Screen sharing using giggle.js  Group chat/calls  Call history
  • 13. Reference Links  XMPP and WebSocket - http://stackoverflow.com/a/26560860, https://blog.andyet.com/2014/10/30/websocket/  XMPP over Socket.io - http://stackoverflow.com/a/33868081  Jingle - http://xmpp.org/extensions/xep-0166.pdf  XMPP fundamental stanza examples - http://xmpp.org/rfcs/rfc3921.html#stanzas-presence-children-show  BOSH vs WebSockets - http://stackoverflow.com/a/6442488  XMPP and WebRTC - https://xmpp.org/uses/webrtc.html  Lua vs Erlang - http://vschart.com/compare/lua/vs/erlang-programming-language