SlideShare a Scribd company logo
1 of 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

More Related Content

What's hot

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
 

What's hot (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
 

Similar to 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
 

Similar to 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
 

Recently uploaded

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
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
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 

Recently uploaded (20)

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
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
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 

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