SlideShare a Scribd company logo
1 of 39
Download to read offline
Building a Desktop
Streaming console with
Electron and ReactJS
Playing with HTML, JS and CSS out of the
sandbox
W W W. S P R E A K E R .C O M
Who am i?
Emanuele Rampichini
• Software engineer @spreaker
• JavaScript enthusiast
• Github pusher on https://github.com/lele85
• “Not so active” tweeting bird @emauele_r
• Mountain Bike Lover
W W W. S P R E A K E R .C O M
Who are you?
• Software engineer @{companyName}
• JavaScript enthusiasts
• Github pushers on https://github.com/{{githubUsername}}
• “{{very || notSo}} active” tweeting birds @{{twitterHandle}}
• {{otherUnrelatedPassion}} Lover
W W W. S P R E A K E R .C O M
Why are you here listening to me?
• You don’t know
• You are not listening
• You have to change 6 trains to get home, it’s gonna be a long way back so
you think that a 45 minutes nap is a good idea.
• You want to build a cross platform
“Real World Desktop Application”™
using JavaScript
W W W. S P R E A K E R .C O M
How much“Real World”™
W W W. S P R E A K E R .C O M
How much“Real World”™
W W W. S P R E A K E R .C O M
How much“Real World”™
W W W. S P R E A K E R .C O M
How much“Real World”™
W W W. S P R E A K E R .C O M
How much“Real World”™
W W W. S P R E A K E R .C O M
“
Use HTML, CSS, and JavaScript with Chromium
and Node.js to build your app.
nw.js or Electron?
W W W. S P R E A K E R .C O M
Our winner was?
Faster, Stronger… Better (cit.)
npm install -g electron
W W W. S P R E A K E R .C O M
package.json main_process
renderer_process
W W W. S P R E A K E R .C O M
this looks very interesting given the
state of modern frontend tools
W W W. S P R E A K E R .C O M
basically you are writing a
client app…
• ReactJS
• SystemJS
• JSPM
• Babel
• other libs (moment, underscore, emojione, url,
reconfig, analytics* etc…)
W W W. S P R E A K E R .C O M
WHY React.js
• Unopinionated render engine for the DOM
• Can be fast enough… try to do 16ms render loop
with angular bidirectional binding
• Battle tested by Facebook
W W W. S P R E A K E R .C O M
HOW React.js
• Multiple store single dispatcher flux architecture “for
something" (USER ACTIONS, WEB API, PUSH
NOTIFICATION)
• We rolled out our solution for specific tasks (EVENT
EMITTERS, FINITE STATE MACHINES)
W W W. S P R E A K E R .C O M
Why we used stateful
components
• Sateless components are cool but sometimes you just
need trade purity for performance
W W W. S P R E A K E R .C O M
SystemJS + JSPM
Universal dynamic module loader - loads ES6 modules,
AMD, CommonJS and global scripts in the browser and
NodeJS. Works with both Traceur and Babel.
jspm is a package manager for the SystemJS universal
module loader, built on top of the dynamic ES6 module
loader
W W W. S P R E A K E R .C O M
SystemJS
• Unopinionated (not a client tool)
• Understands dependencies tree
• Dependencies versioning done right (can you hear
me npm?)
• Can do client side transpiling* (keep an eye on
performance here)
• Has an advanced bundler for production (transpiling,
minification, bundle arithmetic)
W W W. S P R E A K E R .C O M
JSPM
• jspm init
• jspm install
• jspm bundle
You can have ES6 ready environment ready in two
minutes*.
* Beware the automagic beast… could bite you :)
https://www.youtube.com/watch?v=NpMnRifyGyw
W W W. S P R E A K E R .C O M
back to electron…you can use your
loved chrome dev tools
W W W. S P R E A K E R .C O M
…you can leverage desktop
integration
• Menu
• Notifications
• Shortcuts
• Multiple displays
• …
W W W. S P R E A K E R .C O M
you can go down a bit…
RPC server
to expose
app API
use raw
sockets
W W W. S P R E A K E R .C O M
…you can get more from chromium
https://github.com/atom/electron/blob/master/docs/api/
chrome-command-line-switches.md
http://peter.sh/experiments/chromium-command-
line-switches/
W W W. S P R E A K E R .C O M
…or you can start digging“into the
rabbit hole”
Electron is moving faaaast, use NaN to write
add-ons, dynamic libs can give you headaches
W W W. S P R E A K E R .C O M
…you can unit test inside the
electron environment
https://github.com/lele85/karma-electron-launcher
W W W. S P R E A K E R .C O M
…you have autoupdates
out of the box*
* Works only with signed app, works in a different way on
windows
Single script on a
server returning
update zip uri and
metadata
W W W. S P R E A K E R .C O M
native crash reports are
super easy to collect and test!
Every native crash (out of memory, segmentation faults)
electron send a POST to configured submitUrl with:
platform informations
memory dump in minidump format
W W W. S P R E A K E R .C O M
… not so easy to decode :)
For each version you deliver you need to get electron
debug symbols from project release page
Generate symbols for your native libs with breakpad
tool dump_syms*
Put them in a folder (with a standard structure) and use
minidump_stackwalk* to symbolize them in a correct
way
* you can build these tools from break pad source tree
W W W. S P R E A K E R .C O M
keep in mind something about
desktop apps…
Given: 2 operating systems
And: 10 os versions to support
And: a lot of different hardware
And: a lot of USB devices someone can plug
And: ∞ trash software common user can install
Then: YOUR APP WILL ALWAYS FAIL
W W W. S P R E A K E R .C O M
…act accordingly
• gather all data you can on the host pc
• log on filesystem (log4js, Dispatcher)
• set up a server side issue reporting API
• dont’t assume anything about application state when
something goes terribly wrong
• monitor (universal analytics to the rescue)
W W W. S P R E A K E R .C O M
you can add branding and package your
app for mac and windows in a breeze
https://github.com/atom/grunt-electron-installer
https://github.com/maxogden/electron-packager
W W W. S P R E A K E R .C O M
you can distribute your code in a
“safe way”
Inside electron you can treat your asar bundle as a normal
directory. (you may want to uglify/obfuscate your code)
W W W. S P R E A K E R .C O M
all these things makes me very
happy!
W W W. S P R E A K E R .C O M
Sadly electron has some
downsides…
• You are bundling Chromium with every update.
compressed app size is around 40MB
• You can’t hit Mac App Store and Windows
Marketplace
• Sometimes you have to dig into tools source code
(this can be fun) and spend time on github project
issue tracker
W W W. S P R E A K E R .C O M
but…
• It worked for us
• Makes desktop development fun
• Makes desktop development fast.
W W W. S P R E A K E R .C O M
It worked for us
• 22k downloads in 16 days
• now 800 downloads per day
• 25k sessions (mean time 1h 30m)
• 11 releases delivered via autoupdate
(1.0.0 => 1.0.11)
Thanks!
I broadcasted this talk to my colleagues
using the product we built :)
W W W. S P R E A K E R .C O M
One more thing…
https://www.spreaker.com/jobs

More Related Content

What's hot

Cross-Platform Desktop Apps with Electron (Condensed Version)
Cross-Platform Desktop Apps with Electron (Condensed Version)Cross-Platform Desktop Apps with Electron (Condensed Version)
Cross-Platform Desktop Apps with Electron (Condensed Version)David Neal
 
Get that Corner Office with Angular 2 and Electron
Get that Corner Office with Angular 2 and ElectronGet that Corner Office with Angular 2 and Electron
Get that Corner Office with Angular 2 and ElectronLukas Ruebbelke
 
Building Native Experiences with Electron
Building Native Experiences with ElectronBuilding Native Experiences with Electron
Building Native Experiences with ElectronBen Gotow
 
Building desktop applications with web technologies - ELECTRON the easy way
Building desktop applications with web technologies - ELECTRON the easy wayBuilding desktop applications with web technologies - ELECTRON the easy way
Building desktop applications with web technologies - ELECTRON the easy waystefanjudis
 
Cross-Platform Desktop Apps with Electron (JSConf UY)
Cross-Platform Desktop Apps with Electron (JSConf UY)Cross-Platform Desktop Apps with Electron (JSConf UY)
Cross-Platform Desktop Apps with Electron (JSConf UY)David Neal
 
Native Desktop App with Node.js Webkit (HTML, CSS & Javascript)
Native Desktop App with Node.js Webkit (HTML, CSS & Javascript)Native Desktop App with Node.js Webkit (HTML, CSS & Javascript)
Native Desktop App with Node.js Webkit (HTML, CSS & Javascript)Eddie Lau
 
.NET no Browser - Webassembly com Blazor!
.NET no Browser - Webassembly com Blazor!.NET no Browser - Webassembly com Blazor!
.NET no Browser - Webassembly com Blazor!Rodrigo Kono
 
Drupal RPG - A Backend Server Story
Drupal RPG - A Backend Server StoryDrupal RPG - A Backend Server Story
Drupal RPG - A Backend Server StoryEladio Jose Abquina
 
Simplicity - develop modern web apps with tiny frameworks and tools
Simplicity - develop modern web apps with tiny frameworks and toolsSimplicity - develop modern web apps with tiny frameworks and tools
Simplicity - develop modern web apps with tiny frameworks and toolsRui Carvalho
 
Lessons Learned with Unity and WebGL
Lessons Learned with Unity and WebGLLessons Learned with Unity and WebGL
Lessons Learned with Unity and WebGLLior Tal
 
Configuration primer
Configuration primerConfiguration primer
Configuration primerfeanil
 
Testing your Single Page Application
Testing your Single Page ApplicationTesting your Single Page Application
Testing your Single Page ApplicationWekoslav Stefanovski
 
Making Windows Reasonable
Making Windows ReasonableMaking Windows Reasonable
Making Windows ReasonableBryan Phelps
 
Introduction to Phoenix Web Framework
Introduction to Phoenix Web FrameworkIntroduction to Phoenix Web Framework
Introduction to Phoenix Web FrameworkRiza Fahmi
 
FITC - Here Be Dragons: Advanced JavaScript Debugging
FITC - Here Be Dragons: Advanced JavaScript DebuggingFITC - Here Be Dragons: Advanced JavaScript Debugging
FITC - Here Be Dragons: Advanced JavaScript DebuggingRami Sayar
 
Building MapAttack
Building MapAttackBuilding MapAttack
Building MapAttackKyle Drake
 

What's hot (20)

Cross-Platform Desktop Apps with Electron (Condensed Version)
Cross-Platform Desktop Apps with Electron (Condensed Version)Cross-Platform Desktop Apps with Electron (Condensed Version)
Cross-Platform Desktop Apps with Electron (Condensed Version)
 
Get that Corner Office with Angular 2 and Electron
Get that Corner Office with Angular 2 and ElectronGet that Corner Office with Angular 2 and Electron
Get that Corner Office with Angular 2 and Electron
 
Building Native Experiences with Electron
Building Native Experiences with ElectronBuilding Native Experiences with Electron
Building Native Experiences with Electron
 
Building desktop applications with web technologies - ELECTRON the easy way
Building desktop applications with web technologies - ELECTRON the easy wayBuilding desktop applications with web technologies - ELECTRON the easy way
Building desktop applications with web technologies - ELECTRON the easy way
 
Cross-Platform Desktop Apps with Electron (JSConf UY)
Cross-Platform Desktop Apps with Electron (JSConf UY)Cross-Platform Desktop Apps with Electron (JSConf UY)
Cross-Platform Desktop Apps with Electron (JSConf UY)
 
Native Desktop App with Node.js Webkit (HTML, CSS & Javascript)
Native Desktop App with Node.js Webkit (HTML, CSS & Javascript)Native Desktop App with Node.js Webkit (HTML, CSS & Javascript)
Native Desktop App with Node.js Webkit (HTML, CSS & Javascript)
 
.NET no Browser - Webassembly com Blazor!
.NET no Browser - Webassembly com Blazor!.NET no Browser - Webassembly com Blazor!
.NET no Browser - Webassembly com Blazor!
 
Mobile native-hacks
Mobile native-hacksMobile native-hacks
Mobile native-hacks
 
Drupal RPG - A Backend Server Story
Drupal RPG - A Backend Server StoryDrupal RPG - A Backend Server Story
Drupal RPG - A Backend Server Story
 
Simplicity - develop modern web apps with tiny frameworks and tools
Simplicity - develop modern web apps with tiny frameworks and toolsSimplicity - develop modern web apps with tiny frameworks and tools
Simplicity - develop modern web apps with tiny frameworks and tools
 
From Web to Mobile with Stage 3D
From Web to Mobile with Stage 3DFrom Web to Mobile with Stage 3D
From Web to Mobile with Stage 3D
 
Ten years later
Ten years laterTen years later
Ten years later
 
Automation
AutomationAutomation
Automation
 
Lessons Learned with Unity and WebGL
Lessons Learned with Unity and WebGLLessons Learned with Unity and WebGL
Lessons Learned with Unity and WebGL
 
Configuration primer
Configuration primerConfiguration primer
Configuration primer
 
Testing your Single Page Application
Testing your Single Page ApplicationTesting your Single Page Application
Testing your Single Page Application
 
Making Windows Reasonable
Making Windows ReasonableMaking Windows Reasonable
Making Windows Reasonable
 
Introduction to Phoenix Web Framework
Introduction to Phoenix Web FrameworkIntroduction to Phoenix Web Framework
Introduction to Phoenix Web Framework
 
FITC - Here Be Dragons: Advanced JavaScript Debugging
FITC - Here Be Dragons: Advanced JavaScript DebuggingFITC - Here Be Dragons: Advanced JavaScript Debugging
FITC - Here Be Dragons: Advanced JavaScript Debugging
 
Building MapAttack
Building MapAttackBuilding MapAttack
Building MapAttack
 

Similar to Building a Desktop Streaming console with Electron and ReactJS

C++ on the Web: Run your big 3D game in the browser
C++ on the Web: Run your big 3D game in the browserC++ on the Web: Run your big 3D game in the browser
C++ on the Web: Run your big 3D game in the browserAndre Weissflog
 
Docker for Development
Docker for DevelopmentDocker for Development
Docker for Developmentallingeek
 
LXC to Docker Via Continuous Delivery
LXC to Docker Via Continuous DeliveryLXC to Docker Via Continuous Delivery
LXC to Docker Via Continuous DeliveryDocker, Inc.
 
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVMJung Kim
 
Web (dis)assembly
Web (dis)assemblyWeb (dis)assembly
Web (dis)assemblyShakacon
 
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5David Voyles
 
CC-Castle; The best Real-Time/Embedded/HighTech language EVER?
CC-Castle; The best Real-Time/Embedded/HighTech language EVER?CC-Castle; The best Real-Time/Embedded/HighTech language EVER?
CC-Castle; The best Real-Time/Embedded/HighTech language EVER?Albert Mietus
 
A complete guide to Node.js
A complete guide to Node.jsA complete guide to Node.js
A complete guide to Node.jsPrabin Silwal
 
WebAssembly - czy dzisiaj mi się to przyda do pracy?
WebAssembly - czy dzisiaj mi się to przyda do pracy?WebAssembly - czy dzisiaj mi się to przyda do pracy?
WebAssembly - czy dzisiaj mi się to przyda do pracy?Brainhub
 
Learn Electron for Web Developers
Learn Electron for Web DevelopersLearn Electron for Web Developers
Learn Electron for Web DevelopersKyle Cearley
 
Everything-as-code - A polyglot adventure
Everything-as-code - A polyglot adventureEverything-as-code - A polyglot adventure
Everything-as-code - A polyglot adventureQAware GmbH
 
Everything-as-code. A polyglot adventure. #DevoxxPL
Everything-as-code. A polyglot adventure. #DevoxxPLEverything-as-code. A polyglot adventure. #DevoxxPL
Everything-as-code. A polyglot adventure. #DevoxxPLMario-Leander Reimer
 
TestUpload
TestUploadTestUpload
TestUploadZarksaDS
 
Continuous integration by Rémy Virin
Continuous integration by Rémy VirinContinuous integration by Rémy Virin
Continuous integration by Rémy VirinCocoaHeads France
 
electron for emberists
electron for emberistselectron for emberists
electron for emberistsAidan Nulman
 
Docker in development
Docker in developmentDocker in development
Docker in developmentsethvoltz
 

Similar to Building a Desktop Streaming console with Electron and ReactJS (20)

C++ on the Web: Run your big 3D game in the browser
C++ on the Web: Run your big 3D game in the browserC++ on the Web: Run your big 3D game in the browser
C++ on the Web: Run your big 3D game in the browser
 
Docker for Development
Docker for DevelopmentDocker for Development
Docker for Development
 
LXC to Docker Via Continuous Delivery
LXC to Docker Via Continuous DeliveryLXC to Docker Via Continuous Delivery
LXC to Docker Via Continuous Delivery
 
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
 
Web (dis)assembly
Web (dis)assemblyWeb (dis)assembly
Web (dis)assembly
 
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
 
Effective C++
Effective C++Effective C++
Effective C++
 
CC-Castle; The best Real-Time/Embedded/HighTech language EVER?
CC-Castle; The best Real-Time/Embedded/HighTech language EVER?CC-Castle; The best Real-Time/Embedded/HighTech language EVER?
CC-Castle; The best Real-Time/Embedded/HighTech language EVER?
 
A complete guide to Node.js
A complete guide to Node.jsA complete guide to Node.js
A complete guide to Node.js
 
WebAssembly - czy dzisiaj mi się to przyda do pracy?
WebAssembly - czy dzisiaj mi się to przyda do pracy?WebAssembly - czy dzisiaj mi się to przyda do pracy?
WebAssembly - czy dzisiaj mi się to przyda do pracy?
 
WebAssemlby vs JavaScript
WebAssemlby vs JavaScriptWebAssemlby vs JavaScript
WebAssemlby vs JavaScript
 
Learn Electron for Web Developers
Learn Electron for Web DevelopersLearn Electron for Web Developers
Learn Electron for Web Developers
 
Everything-as-code - A polyglot adventure
Everything-as-code - A polyglot adventureEverything-as-code - A polyglot adventure
Everything-as-code - A polyglot adventure
 
Everything-as-code. A polyglot adventure. #DevoxxPL
Everything-as-code. A polyglot adventure. #DevoxxPLEverything-as-code. A polyglot adventure. #DevoxxPL
Everything-as-code. A polyglot adventure. #DevoxxPL
 
TestUpload
TestUploadTestUpload
TestUpload
 
Continuous integration by Rémy Virin
Continuous integration by Rémy VirinContinuous integration by Rémy Virin
Continuous integration by Rémy Virin
 
electron for emberists
electron for emberistselectron for emberists
electron for emberists
 
Node azure
Node azureNode azure
Node azure
 
Docker in development
Docker in developmentDocker in development
Docker in development
 
Node.js debugging
Node.js debuggingNode.js debugging
Node.js debugging
 

More from Emanuele Rampichini

What is quality? Why should i care?
What is quality? Why should i care? What is quality? Why should i care?
What is quality? Why should i care? Emanuele Rampichini
 
I segreti di una campagna di crowdfunding civico di successo
I segreti di una campagna di crowdfunding civico di successoI segreti di una campagna di crowdfunding civico di successo
I segreti di una campagna di crowdfunding civico di successoEmanuele Rampichini
 
Lavorare con tecnologie "Cool" senza rinunciare all'accessibilità
Lavorare con tecnologie "Cool" senza rinunciare all'accessibilitàLavorare con tecnologie "Cool" senza rinunciare all'accessibilità
Lavorare con tecnologie "Cool" senza rinunciare all'accessibilitàEmanuele Rampichini
 
How to push a react js application in production and sleep better
How to push a react js application in production and sleep betterHow to push a react js application in production and sleep better
How to push a react js application in production and sleep betterEmanuele Rampichini
 
Speed up your Titanium app development with automated tests - TiConf EU 2014
Speed up your Titanium app development with automated tests - TiConf EU 2014Speed up your Titanium app development with automated tests - TiConf EU 2014
Speed up your Titanium app development with automated tests - TiConf EU 2014Emanuele Rampichini
 
AngularDevConf - Tools and testing
AngularDevConf - Tools and testingAngularDevConf - Tools and testing
AngularDevConf - Tools and testingEmanuele Rampichini
 
Coderetreat 2013 @cowo42 (Osimo - AN)
Coderetreat 2013 @cowo42 (Osimo - AN)Coderetreat 2013 @cowo42 (Osimo - AN)
Coderetreat 2013 @cowo42 (Osimo - AN)Emanuele Rampichini
 

More from Emanuele Rampichini (7)

What is quality? Why should i care?
What is quality? Why should i care? What is quality? Why should i care?
What is quality? Why should i care?
 
I segreti di una campagna di crowdfunding civico di successo
I segreti di una campagna di crowdfunding civico di successoI segreti di una campagna di crowdfunding civico di successo
I segreti di una campagna di crowdfunding civico di successo
 
Lavorare con tecnologie "Cool" senza rinunciare all'accessibilità
Lavorare con tecnologie "Cool" senza rinunciare all'accessibilitàLavorare con tecnologie "Cool" senza rinunciare all'accessibilità
Lavorare con tecnologie "Cool" senza rinunciare all'accessibilità
 
How to push a react js application in production and sleep better
How to push a react js application in production and sleep betterHow to push a react js application in production and sleep better
How to push a react js application in production and sleep better
 
Speed up your Titanium app development with automated tests - TiConf EU 2014
Speed up your Titanium app development with automated tests - TiConf EU 2014Speed up your Titanium app development with automated tests - TiConf EU 2014
Speed up your Titanium app development with automated tests - TiConf EU 2014
 
AngularDevConf - Tools and testing
AngularDevConf - Tools and testingAngularDevConf - Tools and testing
AngularDevConf - Tools and testing
 
Coderetreat 2013 @cowo42 (Osimo - AN)
Coderetreat 2013 @cowo42 (Osimo - AN)Coderetreat 2013 @cowo42 (Osimo - AN)
Coderetreat 2013 @cowo42 (Osimo - AN)
 

Recently uploaded

System Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event SchedulingSystem Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event SchedulingBootNeck1
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
Katarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School CourseKatarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School Coursebim.edu.pl
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvLewisJB
 
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxMine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxRomil Mishra
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfAsst.prof M.Gokilavani
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)Dr SOUNDIRARAJ N
 
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONTHE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONjhunlian
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleAlluxio, Inc.
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
Crushers to screens in aggregate production
Crushers to screens in aggregate productionCrushers to screens in aggregate production
Crushers to screens in aggregate productionChinnuNinan
 
Indian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptIndian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptMadan Karki
 
Configuration of IoT devices - Systems managament
Configuration of IoT devices - Systems managamentConfiguration of IoT devices - Systems managament
Configuration of IoT devices - Systems managamentBharaniDharan195623
 
Research Methodology for Engineering pdf
Research Methodology for Engineering pdfResearch Methodology for Engineering pdf
Research Methodology for Engineering pdfCaalaaAbdulkerim
 
Internet of things -Arshdeep Bahga .pptx
Internet of things -Arshdeep Bahga .pptxInternet of things -Arshdeep Bahga .pptx
Internet of things -Arshdeep Bahga .pptxVelmuruganTECE
 
Ch10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdfCh10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdfChristianCDAM
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating SystemRashmi Bhat
 
DM Pillar Training Manual.ppt will be useful in deploying TPM in project
DM Pillar Training Manual.ppt will be useful in deploying TPM in projectDM Pillar Training Manual.ppt will be useful in deploying TPM in project
DM Pillar Training Manual.ppt will be useful in deploying TPM in projectssuserb6619e
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptSAURABHKUMAR892774
 

Recently uploaded (20)

System Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event SchedulingSystem Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event Scheduling
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
Katarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School CourseKatarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School Course
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvv
 
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxMine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptx
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
 
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONTHE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at Scale
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
Crushers to screens in aggregate production
Crushers to screens in aggregate productionCrushers to screens in aggregate production
Crushers to screens in aggregate production
 
Indian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptIndian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.ppt
 
Configuration of IoT devices - Systems managament
Configuration of IoT devices - Systems managamentConfiguration of IoT devices - Systems managament
Configuration of IoT devices - Systems managament
 
Research Methodology for Engineering pdf
Research Methodology for Engineering pdfResearch Methodology for Engineering pdf
Research Methodology for Engineering pdf
 
Internet of things -Arshdeep Bahga .pptx
Internet of things -Arshdeep Bahga .pptxInternet of things -Arshdeep Bahga .pptx
Internet of things -Arshdeep Bahga .pptx
 
Ch10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdfCh10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdf
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating System
 
DM Pillar Training Manual.ppt will be useful in deploying TPM in project
DM Pillar Training Manual.ppt will be useful in deploying TPM in projectDM Pillar Training Manual.ppt will be useful in deploying TPM in project
DM Pillar Training Manual.ppt will be useful in deploying TPM in project
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 

Building a Desktop Streaming console with Electron and ReactJS

  • 1. Building a Desktop Streaming console with Electron and ReactJS Playing with HTML, JS and CSS out of the sandbox
  • 2. W W W. S P R E A K E R .C O M Who am i? Emanuele Rampichini • Software engineer @spreaker • JavaScript enthusiast • Github pusher on https://github.com/lele85 • “Not so active” tweeting bird @emauele_r • Mountain Bike Lover
  • 3. W W W. S P R E A K E R .C O M Who are you? • Software engineer @{companyName} • JavaScript enthusiasts • Github pushers on https://github.com/{{githubUsername}} • “{{very || notSo}} active” tweeting birds @{{twitterHandle}} • {{otherUnrelatedPassion}} Lover
  • 4. W W W. S P R E A K E R .C O M Why are you here listening to me? • You don’t know • You are not listening • You have to change 6 trains to get home, it’s gonna be a long way back so you think that a 45 minutes nap is a good idea. • You want to build a cross platform “Real World Desktop Application”™ using JavaScript
  • 5. W W W. S P R E A K E R .C O M How much“Real World”™
  • 6. W W W. S P R E A K E R .C O M How much“Real World”™
  • 7. W W W. S P R E A K E R .C O M How much“Real World”™
  • 8. W W W. S P R E A K E R .C O M How much“Real World”™
  • 9. W W W. S P R E A K E R .C O M How much“Real World”™
  • 10. W W W. S P R E A K E R .C O M “ Use HTML, CSS, and JavaScript with Chromium and Node.js to build your app. nw.js or Electron?
  • 11. W W W. S P R E A K E R .C O M Our winner was? Faster, Stronger… Better (cit.) npm install -g electron
  • 12. W W W. S P R E A K E R .C O M package.json main_process renderer_process
  • 13. W W W. S P R E A K E R .C O M this looks very interesting given the state of modern frontend tools
  • 14. W W W. S P R E A K E R .C O M basically you are writing a client app… • ReactJS • SystemJS • JSPM • Babel • other libs (moment, underscore, emojione, url, reconfig, analytics* etc…)
  • 15. W W W. S P R E A K E R .C O M WHY React.js • Unopinionated render engine for the DOM • Can be fast enough… try to do 16ms render loop with angular bidirectional binding • Battle tested by Facebook
  • 16. W W W. S P R E A K E R .C O M HOW React.js • Multiple store single dispatcher flux architecture “for something" (USER ACTIONS, WEB API, PUSH NOTIFICATION) • We rolled out our solution for specific tasks (EVENT EMITTERS, FINITE STATE MACHINES)
  • 17. W W W. S P R E A K E R .C O M Why we used stateful components • Sateless components are cool but sometimes you just need trade purity for performance
  • 18. W W W. S P R E A K E R .C O M SystemJS + JSPM Universal dynamic module loader - loads ES6 modules, AMD, CommonJS and global scripts in the browser and NodeJS. Works with both Traceur and Babel. jspm is a package manager for the SystemJS universal module loader, built on top of the dynamic ES6 module loader
  • 19. W W W. S P R E A K E R .C O M SystemJS • Unopinionated (not a client tool) • Understands dependencies tree • Dependencies versioning done right (can you hear me npm?) • Can do client side transpiling* (keep an eye on performance here) • Has an advanced bundler for production (transpiling, minification, bundle arithmetic)
  • 20. W W W. S P R E A K E R .C O M JSPM • jspm init • jspm install • jspm bundle You can have ES6 ready environment ready in two minutes*. * Beware the automagic beast… could bite you :) https://www.youtube.com/watch?v=NpMnRifyGyw
  • 21. W W W. S P R E A K E R .C O M back to electron…you can use your loved chrome dev tools
  • 22. W W W. S P R E A K E R .C O M …you can leverage desktop integration • Menu • Notifications • Shortcuts • Multiple displays • …
  • 23. W W W. S P R E A K E R .C O M you can go down a bit… RPC server to expose app API use raw sockets
  • 24. W W W. S P R E A K E R .C O M …you can get more from chromium https://github.com/atom/electron/blob/master/docs/api/ chrome-command-line-switches.md http://peter.sh/experiments/chromium-command- line-switches/
  • 25. W W W. S P R E A K E R .C O M …or you can start digging“into the rabbit hole” Electron is moving faaaast, use NaN to write add-ons, dynamic libs can give you headaches
  • 26. W W W. S P R E A K E R .C O M …you can unit test inside the electron environment https://github.com/lele85/karma-electron-launcher
  • 27. W W W. S P R E A K E R .C O M …you have autoupdates out of the box* * Works only with signed app, works in a different way on windows Single script on a server returning update zip uri and metadata
  • 28. W W W. S P R E A K E R .C O M native crash reports are super easy to collect and test! Every native crash (out of memory, segmentation faults) electron send a POST to configured submitUrl with: platform informations memory dump in minidump format
  • 29. W W W. S P R E A K E R .C O M … not so easy to decode :) For each version you deliver you need to get electron debug symbols from project release page Generate symbols for your native libs with breakpad tool dump_syms* Put them in a folder (with a standard structure) and use minidump_stackwalk* to symbolize them in a correct way * you can build these tools from break pad source tree
  • 30. W W W. S P R E A K E R .C O M keep in mind something about desktop apps… Given: 2 operating systems And: 10 os versions to support And: a lot of different hardware And: a lot of USB devices someone can plug And: ∞ trash software common user can install Then: YOUR APP WILL ALWAYS FAIL
  • 31. W W W. S P R E A K E R .C O M …act accordingly • gather all data you can on the host pc • log on filesystem (log4js, Dispatcher) • set up a server side issue reporting API • dont’t assume anything about application state when something goes terribly wrong • monitor (universal analytics to the rescue)
  • 32. W W W. S P R E A K E R .C O M you can add branding and package your app for mac and windows in a breeze https://github.com/atom/grunt-electron-installer https://github.com/maxogden/electron-packager
  • 33. W W W. S P R E A K E R .C O M you can distribute your code in a “safe way” Inside electron you can treat your asar bundle as a normal directory. (you may want to uglify/obfuscate your code)
  • 34. W W W. S P R E A K E R .C O M all these things makes me very happy!
  • 35. W W W. S P R E A K E R .C O M Sadly electron has some downsides… • You are bundling Chromium with every update. compressed app size is around 40MB • You can’t hit Mac App Store and Windows Marketplace • Sometimes you have to dig into tools source code (this can be fun) and spend time on github project issue tracker
  • 36. W W W. S P R E A K E R .C O M but… • It worked for us • Makes desktop development fun • Makes desktop development fast.
  • 37. W W W. S P R E A K E R .C O M It worked for us • 22k downloads in 16 days • now 800 downloads per day • 25k sessions (mean time 1h 30m) • 11 releases delivered via autoupdate (1.0.0 => 1.0.11)
  • 38. Thanks! I broadcasted this talk to my colleagues using the product we built :)
  • 39. W W W. S P R E A K E R .C O M One more thing… https://www.spreaker.com/jobs