SlideShare a Scribd company logo
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 Engine
joshsmoore
 
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
Jackson F. de A. Mafra
 
Performance tips for Symfony2 & PHP
Performance tips for Symfony2 & PHPPerformance tips for Symfony2 & PHP
Performance tips for Symfony2 & PHP
Max Romanovsky
 
Os Bubna
Os BubnaOs Bubna
Os Bubna
oscon2007
 
Introduction to Apache Maven
Introduction to Apache MavenIntroduction to Apache Maven
Introduction to Apache Maven
Rajind 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 base
Ralf Sternberg
 
Springboot introduction
Springboot introductionSpringboot introduction
Springboot introduction
Sagar Verma
 
TorqueBox
TorqueBoxTorqueBox
TorqueBox
bobmcwhirter
 
Angular + JHipster - JHipster Conf
Angular + JHipster - JHipster ConfAngular + JHipster - JHipster Conf
Angular + JHipster - JHipster Conf
William Marques
 
eXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework IntroductioneXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework Introduction
vstorm83
 
Jvm
JvmJvm
An Introduction to Maven Part 1
An Introduction to Maven Part 1An Introduction to Maven Part 1
An Introduction to Maven Part 1
MD Sayem Ahmed
 
Single Sourcing RCP and RAP
Single Sourcing RCP and RAPSingle Sourcing RCP and RAP
Single Sourcing RCP and RAP
Chris Aniszczyk
 
Introduction to Maven
Introduction to MavenIntroduction to Maven
Introduction to Maven
Onkar Deshpande
 
java new technology
java new technologyjava new technology
java new technology
chavdagirimal
 
Java Builds with Maven and Ant
Java Builds with Maven and AntJava Builds with Maven and Ant
Java Builds with Maven and Ant
David Noble
 
Polyglot Applications with GraalVM
Polyglot Applications with GraalVMPolyglot Applications with GraalVM
Polyglot Applications with GraalVM
jexp
 
Maven tutorial for beginners
Maven tutorial for beginnersMaven tutorial for beginners
Maven tutorial for beginners
inTwentyEight Minutes
 

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 + WPDev
Sam Basu
 
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
 
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
Joseph Labrecque
 
Webrtc in Real world
Webrtc in Real world Webrtc in Real world
Webrtc in Real world
Hanumesh Palla
 
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
Eyeball Networks
 
Web Server-Side Programming Techniques
Web Server-Side Programming TechniquesWeb Server-Side Programming Techniques
Web Server-Side Programming Techniques
guest8899ec02
 
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 Possibilities
Sam Basu
 
Communicating System
Communicating SystemCommunicating System
Communicating System
Ahmad0Muhammad
 
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
Mickaël Rémond
 
Xmpp and java
Xmpp and javaXmpp and java
Xmpp and java
Soham Sengupta
 
Tuenti teams - Php Conference
Tuenti teams - Php ConferenceTuenti teams - Php Conference
Tuenti teams - Php Conference
Guille -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
 
Streaming in grails
Streaming in grailsStreaming in grails
Streaming in grails
Sandeep Sankaye
 
Online test management system
Online test management systemOnline test management system
Online test management system
Prateek Agarwak
 
Servlet by Rj
Servlet by RjServlet 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 ...
IndicThreads
 
Project report for final year project
Project report for final year projectProject report for final year project
Project report for final year project
suneel singh
 
Rest overview briefing
Rest  overview briefingRest  overview briefing
Rest overview briefing
◄ vaquar khan ► ★✔
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
Samy Fodil
 

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
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 

Recently uploaded

National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Data structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdfData structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdf
TIPNGVN2
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Zilliz
 

Recently uploaded (20)

National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Data structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdfData structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdf
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
 

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