SlideShare a Scribd company logo
1 of 24
Download to read offline
REAL TIME EVENT DASHBOARDS
— MUJTABA HUSSAIN —
Who am I?
Infrastructure engineer and developer @ Fillr

Reluctant javascript code maintainer. 

Blatant code copier.
Whats happening now?
Dashboard?

Real time? Is there an un-real time one? Can I get
that one?

What?
At the end …
Its not that hard! Its much harder muhahahahah

Know where to start looking!

For multiple users!
Why did I do this?
Investors. 

Looks cool.

I learnt new stuff.
How I started?
Google “How do I build a google map?”

Google “How do I get norse map source code?”

Google “Please help!”
Screw it, I will build it
myself.
Highmaps

AWS JS SDK

Amazingly horrible JavaScript.
Done, but … meh
Looked OK. 

Updates were basically bubbles. 

My Javascript.
Enter DataMaps
Built on d3js

Solely for maps.

Bit more functionality compared to HighMaps.
Start Simple.
Data on the map.
Data from queue to map.
Did it work?
init: function(){
setTimeout(
jQuery.proxy(this.getData, this),
this.interval
);
}
var sqs = new AWS.SQS({
apiVersion: '2012-11-05',
accessKeyId: 'GREEDOSHOTFIRST',
secretAccessKey: 'TWILIGHTISCOOL',
region: 'ap-southeast-2'
});
Authentication?
I do not want to make this complicated.

Simplest procedure.

AWS::Cognito
Multi-users
Polling the queue within the client would have
issues.

Needed to set it up for a lot of clients.
WebSockets
em-websocket (ruby) as server

WebSocket (JavaScript) for client
EM.run {
EM::WebSocket.run(:host => WS_HOST, :port => WS_PORT) do |ws|
ws.onopen { |handshake|
queue.poll do |msg|
logger.debug 'Websocket connection open'
ws.send MESSAGE_FROM_QUEUE
end
}
ws.onclose { |msg| logger.info "Connection closed" }
ws.onerror { |msg| logger.error "Something went wrong" }
}
end
}
end
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "STATEMENT_ID",
"Effect": "Allow",
"Action": [
"sqs:DeleteMessage",
"sqs:GetQueueAttributes",
"sqs:GetQueueUrl",
"sqs:ListDeadLetterSourceQueues",
"sqs:ListQueues",
"sqs:ReceiveMessage"
],
"Resource": [
"QUEUE_ARN"
]
}
]
}
Timeout
Client and server kept timing out.

Messages kept getting lost.

I kept losing hair.
@channel = EM::Channel.new
threads << Thread.new do
queue.poll do |msg|
logger.debug "Message received #{msg.body}"
@channel.push msg.body
end
end
threads << Thread.new do
EM.run {
EM::WebSocket.run(:host => WS_HOST, :port => WS_PORT) do |ws|
EventMachine.add_periodic_timer(3) { ws.send HEARTBEAT }
ws.onopen { |handshake|
sid = @channel.subscribe {|msg| ws.send msg }
logger.debug 'Websocket connection open'
ws.onmessage {|msg| ws.send “—heartbeat—" }
ws.onclose { |msg| }
ws.onerror { |msg| }
}
end
}
end
ws = new WebSocket("SERVER");
var heartbeat_msg = '--heartbeat--';
ws.onopen = function(evt) {
if (heartbeat_interval == null) {
missed_heartbeats = 0;
heartbeat_interval = setInterval(function() {
SEND_HEARTBEAT }, X_TIME_UNITS
);
}
};
ws.onclose = function(evt) { console.log("CLOSE" + evt); };
ws.onerror = function(evt) { console.log("ERROR" + evt); };
ws.onmessage = function(evt) {
if (evt.data === heartbeat_msg) {
ACK_HEARTBEAT_AND_RESET;
}
PROCESS_DATA;
};
But wait, there is more.
Deployment intended to AWS.

Where to set up the WebSocket server? 

Surely binding to 0.0.0.0
Cue NGinX awesomeness
server {
listen HTTP_PORT;
server_name MAP_ENDPOINT;
location /socketcluster {
proxy_pass http://0.0.0.0:WS_PORT;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location / {
rewrite ^/(.*) /$1 break;
proxy_ignore_client_abort on;
proxy_pass http://localhost:LOCAL_HTTP_PORT;
proxy_redirect http://localhost:LOCAL_HTTP_PORT MAP_ENDPOINT;
proxy_set_header HEADERS;
}
}
Real time event dashboards

More Related Content

What's hot

Service worker - Offline Web
Service worker - Offline WebService worker - Offline Web
Service worker - Offline WebBruno Oliveira
 
Upstate CSCI 450 WebDev Chapter 4
Upstate CSCI 450 WebDev Chapter 4Upstate CSCI 450 WebDev Chapter 4
Upstate CSCI 450 WebDev Chapter 4DanWooster1
 
Webpack packing it all
Webpack packing it allWebpack packing it all
Webpack packing it allCriciúma Dev
 
Websockets talk at Rubyconf Uruguay 2010
Websockets talk at Rubyconf Uruguay 2010Websockets talk at Rubyconf Uruguay 2010
Websockets talk at Rubyconf Uruguay 2010Ismael Celis
 
Future Decoded - Node.js per sviluppatori .NET
Future Decoded - Node.js per sviluppatori .NETFuture Decoded - Node.js per sviluppatori .NET
Future Decoded - Node.js per sviluppatori .NETGianluca Carucci
 
MinbilDinbil Django Speed Tricks
MinbilDinbil Django Speed TricksMinbilDinbil Django Speed Tricks
MinbilDinbil Django Speed TricksLorenzo Setale
 
Forensic Tools for In-Depth Performance Investigations
Forensic Tools for In-Depth Performance InvestigationsForensic Tools for In-Depth Performance Investigations
Forensic Tools for In-Depth Performance InvestigationsNicholas Jansma
 
Upstate CSCI 450 WebDev Chapter 4
Upstate CSCI 450 WebDev Chapter 4Upstate CSCI 450 WebDev Chapter 4
Upstate CSCI 450 WebDev Chapter 4DanWooster1
 
Get Ahead with HTML5 on Moible
Get Ahead with HTML5 on MoibleGet Ahead with HTML5 on Moible
Get Ahead with HTML5 on Moiblemarkuskobler
 
Breaking the Server-Client Divide with Node.js and React
Breaking the Server-Client Divide with Node.js and ReactBreaking the Server-Client Divide with Node.js and React
Breaking the Server-Client Divide with Node.js and ReactDejan Glozic
 
Service workers and the role they play in modern day web apps
Service workers and the role they play in modern day web appsService workers and the role they play in modern day web apps
Service workers and the role they play in modern day web appsMukul Jain
 
JSChannel 2017 - Service Workers and the Role they Play in modern day web-apps
JSChannel 2017 - Service Workers and the Role they Play in modern day web-appsJSChannel 2017 - Service Workers and the Role they Play in modern day web-apps
JSChannel 2017 - Service Workers and the Role they Play in modern day web-appsMukul Jain
 
Building Faster Websites
Building Faster WebsitesBuilding Faster Websites
Building Faster WebsitesMatthew Farina
 
Kubernetes Native Java
Kubernetes Native JavaKubernetes Native Java
Kubernetes Native JavaAlex Soto
 
Drupal point of vue
Drupal point of vueDrupal point of vue
Drupal point of vueDavid Ličen
 
Real World Lessons in Progressive Web Application & Service Worker Caching
Real World Lessons in Progressive Web Application & Service Worker CachingReal World Lessons in Progressive Web Application & Service Worker Caching
Real World Lessons in Progressive Web Application & Service Worker CachingChris Love
 
3D Web Programming [Thanh Loc Vo , CTO Epsilon Mobile ]
3D Web Programming [Thanh Loc Vo , CTO Epsilon Mobile ]3D Web Programming [Thanh Loc Vo , CTO Epsilon Mobile ]
3D Web Programming [Thanh Loc Vo , CTO Epsilon Mobile ]JavaScript Meetup HCMC
 

What's hot (20)

Service worker API
Service worker APIService worker API
Service worker API
 
Service worker - Offline Web
Service worker - Offline WebService worker - Offline Web
Service worker - Offline Web
 
Upstate CSCI 450 WebDev Chapter 4
Upstate CSCI 450 WebDev Chapter 4Upstate CSCI 450 WebDev Chapter 4
Upstate CSCI 450 WebDev Chapter 4
 
Webpack packing it all
Webpack packing it allWebpack packing it all
Webpack packing it all
 
Websockets talk at Rubyconf Uruguay 2010
Websockets talk at Rubyconf Uruguay 2010Websockets talk at Rubyconf Uruguay 2010
Websockets talk at Rubyconf Uruguay 2010
 
Future Decoded - Node.js per sviluppatori .NET
Future Decoded - Node.js per sviluppatori .NETFuture Decoded - Node.js per sviluppatori .NET
Future Decoded - Node.js per sviluppatori .NET
 
MinbilDinbil Django Speed Tricks
MinbilDinbil Django Speed TricksMinbilDinbil Django Speed Tricks
MinbilDinbil Django Speed Tricks
 
Forensic Tools for In-Depth Performance Investigations
Forensic Tools for In-Depth Performance InvestigationsForensic Tools for In-Depth Performance Investigations
Forensic Tools for In-Depth Performance Investigations
 
Upstate CSCI 450 WebDev Chapter 4
Upstate CSCI 450 WebDev Chapter 4Upstate CSCI 450 WebDev Chapter 4
Upstate CSCI 450 WebDev Chapter 4
 
Service workers
Service workersService workers
Service workers
 
Get Ahead with HTML5 on Moible
Get Ahead with HTML5 on MoibleGet Ahead with HTML5 on Moible
Get Ahead with HTML5 on Moible
 
Breaking the Server-Client Divide with Node.js and React
Breaking the Server-Client Divide with Node.js and ReactBreaking the Server-Client Divide with Node.js and React
Breaking the Server-Client Divide with Node.js and React
 
Service workers and the role they play in modern day web apps
Service workers and the role they play in modern day web appsService workers and the role they play in modern day web apps
Service workers and the role they play in modern day web apps
 
JSChannel 2017 - Service Workers and the Role they Play in modern day web-apps
JSChannel 2017 - Service Workers and the Role they Play in modern day web-appsJSChannel 2017 - Service Workers and the Role they Play in modern day web-apps
JSChannel 2017 - Service Workers and the Role they Play in modern day web-apps
 
Building Faster Websites
Building Faster WebsitesBuilding Faster Websites
Building Faster Websites
 
Kubernetes Native Java
Kubernetes Native JavaKubernetes Native Java
Kubernetes Native Java
 
Drupal point of vue
Drupal point of vueDrupal point of vue
Drupal point of vue
 
Real World Lessons in Progressive Web Application & Service Worker Caching
Real World Lessons in Progressive Web Application & Service Worker CachingReal World Lessons in Progressive Web Application & Service Worker Caching
Real World Lessons in Progressive Web Application & Service Worker Caching
 
3D Web Programming [Thanh Loc Vo , CTO Epsilon Mobile ]
3D Web Programming [Thanh Loc Vo , CTO Epsilon Mobile ]3D Web Programming [Thanh Loc Vo , CTO Epsilon Mobile ]
3D Web Programming [Thanh Loc Vo , CTO Epsilon Mobile ]
 
Attribute actions
Attribute actionsAttribute actions
Attribute actions
 

Similar to Real time event dashboards

Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applicationsTom Croucher
 
Real World Lessons on the Pain Points of Node.JS Application
Real World Lessons on the Pain Points of Node.JS ApplicationReal World Lessons on the Pain Points of Node.JS Application
Real World Lessons on the Pain Points of Node.JS ApplicationBen Hall
 
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch
 
Event-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineEvent-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineRicardo Silva
 
Hazelcast and MongoDB at Cloud CMS
Hazelcast and MongoDB at Cloud CMSHazelcast and MongoDB at Cloud CMS
Hazelcast and MongoDB at Cloud CMSuzquiano
 
Practical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsPractical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsasync_io
 
Coolblue - Behind the Scenes Continuous Integration & Deployment
Coolblue - Behind the Scenes Continuous Integration & DeploymentCoolblue - Behind the Scenes Continuous Integration & Deployment
Coolblue - Behind the Scenes Continuous Integration & DeploymentMatthew Hodgkins
 
[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVCAlive Kuo
 
Comet with node.js and V8
Comet with node.js and V8Comet with node.js and V8
Comet with node.js and V8amix3k
 
Everything is Awesome - Cutting the Corners off the Web
Everything is Awesome - Cutting the Corners off the WebEverything is Awesome - Cutting the Corners off the Web
Everything is Awesome - Cutting the Corners off the WebJames Rakich
 
Introducing to node.js
Introducing to node.jsIntroducing to node.js
Introducing to node.jsJeongHun Byeon
 
Modern server side development with node.js - Benjamin gruenbaum
Modern server side development with node.js - Benjamin gruenbaumModern server side development with node.js - Benjamin gruenbaum
Modern server side development with node.js - Benjamin gruenbaumgeektimecoil
 
Live Streaming & Server Sent Events
Live Streaming & Server Sent EventsLive Streaming & Server Sent Events
Live Streaming & Server Sent Eventstkramar
 
Developing node-mdb: a Node.js - based clone of SimpleDB
Developing node-mdb: a Node.js - based clone of SimpleDBDeveloping node-mdb: a Node.js - based clone of SimpleDB
Developing node-mdb: a Node.js - based clone of SimpleDBRob Tweed
 
Intro to node and mongodb 1
Intro to node and mongodb   1Intro to node and mongodb   1
Intro to node and mongodb 1Mohammad Qureshi
 
Sufan presentation
Sufan presentationSufan presentation
Sufan presentationSufanhk
 
Introducing the Seneca MVP framework for Node.js
Introducing the Seneca MVP framework for Node.jsIntroducing the Seneca MVP framework for Node.js
Introducing the Seneca MVP framework for Node.jsRichard Rodger
 

Similar to Real time event dashboards (20)

AngularJS and SPA
AngularJS and SPAAngularJS and SPA
AngularJS and SPA
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
 
Node azure
Node azureNode azure
Node azure
 
Real World Lessons on the Pain Points of Node.JS Application
Real World Lessons on the Pain Points of Node.JS ApplicationReal World Lessons on the Pain Points of Node.JS Application
Real World Lessons on the Pain Points of Node.JS Application
 
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.js
 
Event-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineEvent-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 Engine
 
Hazelcast and MongoDB at Cloud CMS
Hazelcast and MongoDB at Cloud CMSHazelcast and MongoDB at Cloud CMS
Hazelcast and MongoDB at Cloud CMS
 
Practical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsPractical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.js
 
Coolblue - Behind the Scenes Continuous Integration & Deployment
Coolblue - Behind the Scenes Continuous Integration & DeploymentCoolblue - Behind the Scenes Continuous Integration & Deployment
Coolblue - Behind the Scenes Continuous Integration & Deployment
 
[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC
 
Comet with node.js and V8
Comet with node.js and V8Comet with node.js and V8
Comet with node.js and V8
 
Everything is Awesome - Cutting the Corners off the Web
Everything is Awesome - Cutting the Corners off the WebEverything is Awesome - Cutting the Corners off the Web
Everything is Awesome - Cutting the Corners off the Web
 
Introducing to node.js
Introducing to node.jsIntroducing to node.js
Introducing to node.js
 
Modern server side development with node.js - Benjamin gruenbaum
Modern server side development with node.js - Benjamin gruenbaumModern server side development with node.js - Benjamin gruenbaum
Modern server side development with node.js - Benjamin gruenbaum
 
Live Streaming & Server Sent Events
Live Streaming & Server Sent EventsLive Streaming & Server Sent Events
Live Streaming & Server Sent Events
 
Developing node-mdb: a Node.js - based clone of SimpleDB
Developing node-mdb: a Node.js - based clone of SimpleDBDeveloping node-mdb: a Node.js - based clone of SimpleDB
Developing node-mdb: a Node.js - based clone of SimpleDB
 
Intro to node and mongodb 1
Intro to node and mongodb   1Intro to node and mongodb   1
Intro to node and mongodb 1
 
Sufan presentation
Sufan presentationSufan presentation
Sufan presentation
 
Introducing the Seneca MVP framework for Node.js
Introducing the Seneca MVP framework for Node.jsIntroducing the Seneca MVP framework for Node.js
Introducing the Seneca MVP framework for Node.js
 
20120816 nodejsdublin
20120816 nodejsdublin20120816 nodejsdublin
20120816 nodejsdublin
 

Recently uploaded

result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 

Recently uploaded (20)

result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 

Real time event dashboards

  • 1. REAL TIME EVENT DASHBOARDS — MUJTABA HUSSAIN —
  • 2. Who am I? Infrastructure engineer and developer @ Fillr Reluctant javascript code maintainer. Blatant code copier.
  • 3. Whats happening now? Dashboard? Real time? Is there an un-real time one? Can I get that one? What?
  • 4. At the end … Its not that hard! Its much harder muhahahahah Know where to start looking! For multiple users!
  • 5. Why did I do this? Investors. Looks cool. I learnt new stuff.
  • 6. How I started? Google “How do I build a google map?” Google “How do I get norse map source code?” Google “Please help!”
  • 7. Screw it, I will build it myself. Highmaps AWS JS SDK Amazingly horrible JavaScript.
  • 8. Done, but … meh Looked OK. Updates were basically bubbles. My Javascript.
  • 9. Enter DataMaps Built on d3js Solely for maps. Bit more functionality compared to HighMaps.
  • 11. Data on the map.
  • 12. Data from queue to map.
  • 14. init: function(){ setTimeout( jQuery.proxy(this.getData, this), this.interval ); } var sqs = new AWS.SQS({ apiVersion: '2012-11-05', accessKeyId: 'GREEDOSHOTFIRST', secretAccessKey: 'TWILIGHTISCOOL', region: 'ap-southeast-2' });
  • 15. Authentication? I do not want to make this complicated. Simplest procedure. AWS::Cognito
  • 16. Multi-users Polling the queue within the client would have issues. Needed to set it up for a lot of clients.
  • 17. WebSockets em-websocket (ruby) as server WebSocket (JavaScript) for client
  • 18. EM.run { EM::WebSocket.run(:host => WS_HOST, :port => WS_PORT) do |ws| ws.onopen { |handshake| queue.poll do |msg| logger.debug 'Websocket connection open' ws.send MESSAGE_FROM_QUEUE end } ws.onclose { |msg| logger.info "Connection closed" } ws.onerror { |msg| logger.error "Something went wrong" } } end } end
  • 19. { "Version": "2012-10-17", "Statement": [ { "Sid": "STATEMENT_ID", "Effect": "Allow", "Action": [ "sqs:DeleteMessage", "sqs:GetQueueAttributes", "sqs:GetQueueUrl", "sqs:ListDeadLetterSourceQueues", "sqs:ListQueues", "sqs:ReceiveMessage" ], "Resource": [ "QUEUE_ARN" ] } ] }
  • 20. Timeout Client and server kept timing out. Messages kept getting lost. I kept losing hair.
  • 21. @channel = EM::Channel.new threads << Thread.new do queue.poll do |msg| logger.debug "Message received #{msg.body}" @channel.push msg.body end end threads << Thread.new do EM.run { EM::WebSocket.run(:host => WS_HOST, :port => WS_PORT) do |ws| EventMachine.add_periodic_timer(3) { ws.send HEARTBEAT } ws.onopen { |handshake| sid = @channel.subscribe {|msg| ws.send msg } logger.debug 'Websocket connection open' ws.onmessage {|msg| ws.send “—heartbeat—" } ws.onclose { |msg| } ws.onerror { |msg| } } end } end ws = new WebSocket("SERVER"); var heartbeat_msg = '--heartbeat--'; ws.onopen = function(evt) { if (heartbeat_interval == null) { missed_heartbeats = 0; heartbeat_interval = setInterval(function() { SEND_HEARTBEAT }, X_TIME_UNITS ); } }; ws.onclose = function(evt) { console.log("CLOSE" + evt); }; ws.onerror = function(evt) { console.log("ERROR" + evt); }; ws.onmessage = function(evt) { if (evt.data === heartbeat_msg) { ACK_HEARTBEAT_AND_RESET; } PROCESS_DATA; };
  • 22. But wait, there is more. Deployment intended to AWS. Where to set up the WebSocket server? Surely binding to 0.0.0.0
  • 23. Cue NGinX awesomeness server { listen HTTP_PORT; server_name MAP_ENDPOINT; location /socketcluster { proxy_pass http://0.0.0.0:WS_PORT; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } location / { rewrite ^/(.*) /$1 break; proxy_ignore_client_abort on; proxy_pass http://localhost:LOCAL_HTTP_PORT; proxy_redirect http://localhost:LOCAL_HTTP_PORT MAP_ENDPOINT; proxy_set_header HEADERS; } }