SlideShare una empresa de Scribd logo
1 de 86
Descargar para leer sin conexión
MADRID · NOV 27-28 · 2015
Adding Realtime
To your Apps
Nacho Martín
MADRID · NOV 27-28 · 2015
I write software at limenius.com
3/4 of them need some
form of Real Time
We build web and mobile apps
for clients
We have tried many things in different battles
This year we abstracted carotene-project.com and
opensourced it
MADRID · NOV 27-28 · 2015
A bit of history
Websockets? where we are going
we don’t need Websockets
MADRID · NOV 27-28 · 2015
Meet Tim Berners-Lee, 1991
MADRID · NOV 27-28 · 2015
He worked at CERN
CERN’s ideas are rooted in 18th century Enlightenment
MADRID · NOV 27-28 · 2015
Most important: knowledge
MADRID · NOV 27-28 · 2015
Humans pass knowledge
to next generations!
MADRID · NOV 27-28 · 2015
We stand on the shoulders of giants!
MADRID · NOV 27-28 · 2015
Result: The Very First Web
It is about documents
MADRID · NOV 27-28 · 2015
Under this hypothesis
1%
99%
Produced before request
Produced right now: 1%?
Probably more like
0.0000001%
Human Knowledge
MADRID · NOV 27-28 · 2015
Corollary: If something important happens
after the HTTP request, it will be filtered and
solidified in Knowledge and preserved for
ages! Come again next month.
MADRID · NOV 27-28 · 2015
At CERN they build things pretty well
MADRID · NOV 27-28 · 2015
Archie
News
Irc
Gopher
email
WEBFtp
MADRID · NOV 27-28 · 2015
Under the document paradigm
MADRID · NOV 27-28 · 2015
Process a Request,
call a program
serve a Response
Serve a Document
Under the document paradigm
Short lived processes
Under the document paradigm
MADRID · NOV 27-28 · 2015
CGI was born
And then…
PHP
Rails Django
Symfony
Wordpress
MediaWiki
Spring
CakePHP
Perl-cgi
Code Igniter
Laravel
MADRID · NOV 27-28 · 2015
This scales very well
!
!
!
!
!


And has been VERY battle tested
MADRID · NOV 27-28 · 2015
25 years have passed
Humanity has been exposed to huge loads
of information
Time to check the enlightement hypothesis
What do people express more interest at?
MADRID · NOV 27-28 · 2015
MADRID · NOV 27-28 · 2015
Meet Tim Berners-Lee, 2015
MADRID · NOV 27-28 · 2015
In face of this sad truth
What to do as a developer?
MADRID · NOV 27-28 · 2015
Possibility 1
(Has chances of doing something
meaningful and be rememebered)
MADRID · NOV 27-28 · 2015
Let’s explore possibility 2
MADRID · NOV 27-28 · 2015
At CERN they build things toowell!
MADRID · NOV 27-28 · 2015
Stretching the paradigm
Backend
Html
JavaScript
MADRID · NOV 27-28 · 2015
Stretching the paradigm
Backend
Html
JavaScript
API
MADRID · NOV 27-28 · 2015
Not what it was built for
Request overhead
Granularity compromise: Requests/min vs Resources
Chaining events: waiting times add up. IoT capable?
Like asking for a video one frame at a time
MADRID · NOV 27-28 · 2015
What do we mean by Real Time
MADRID · NOV 27-28 · 2015
Hard Real Time
Maximum response time guaranteed
We won’t talk about this
MADRID · NOV 27-28 · 2015
Soft Real Time
Reasonable response time
Normally based on human perception
MADRID · NOV 27-28 · 2015
Soft Real Time
For information that loses value with time
MADRID · NOV 27-28 · 2015
Value with time
Your neighbour starts screaming
MADRID · NOV 27-28 · 2015
Use cases where RT is more
beneficial
MADRID · NOV 27-28 · 2015
Analytics
MADRID · NOV 27-28 · 2015
MADRID · NOV 27-28 · 2015
Gaming
MADRID · NOV 27-28 · 2015
Social & Messaging
MADRID · NOV 27-28 · 2015
Collaboration
MADRID · NOV 27-28 · 2015
Amazon Customer Service
MADRID · NOV 27-28 · 2015
Basically,
the less your app looks like this
MADRID · NOV 27-28 · 2015
For how long can we live in a past
paradigm? Kano model
MADRID · NOV 27-28 · 2015
Architecture
MADRID · NOV 27-28 · 2015
WebSockets, what are they
Hack (Standarized, but hack) to turn HTTP back into a
TCP full-duplex connection and call it “upgrade”.
GET /chat HTTP/1.1
Host: server.example.com
Upgrade: WebSocket
Connection: Upgrade
Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
Origin: http://example.com
Sec-WebSocket-Version: 13
HTTP/1.1 101 Switching Protocols
Upgrade: WebSocket
Connection: Upgrade
Sec-WebSocket-Accept: s3pPL<…>Oo=
MADRID · NOV 27-28 · 2015
Can I use Websockets?
88.17%
MADRID · NOV 27-28 · 2015
But Long polling…
Make an Ajax Request, leave it open waiting for a
Response.
Introduces complexity: group chained requests into
“connections”.
Needs buffering handling.
Adds complexity to support the remaining 11.83%.
MADRID · NOV 27-28 · 2015
Three layers-model
Transport
Messaging
Data Sync
Regular HTTP
HTTP
Request/Response
Probably your work
Real Time
Websockets
(or Long polling)
Publish/Subscribe
(or RPC)
Probably your work
MADRID · NOV 27-28 · 2015
There is a fourth layer
Everything our tech model
cannot handle, our brain
has to make up for it
MADRID · NOV 27-28 · 2015
MADRID · NOV 27-28 · 2015
F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5!!!!!!!
Human dealing with a protocol
that doesn’t map reality well
MADRID · NOV 27-28 · 2015
Three layers-model
Transport
Messaging
Data Sync
Core of the product
Where you add value
Implemented in a language
you know well
MADRID · NOV 27-28 · 2015
Three layers-model
Transport
Messaging
Data Sync
Implemented in a
technology very performant
Don’t mix your
business logic with it
MADRID · NOV 27-28 · 2015
Aim for
Transport
Messaging
Data Sync
Regular HTTP
Your work
Real Time
Your work
Nginx/Apache RT Server
MADRID · NOV 27-28 · 2015
MADRID · NOV 27-28 · 2015
DIY approach (typically socket.io)
Tutorial looks super easy, but:
Soon you realise that you must deal with messaging details (who is
in a channel? how to do auth?).
Multi-server environments are up to you (how to know if a user is
connected in a channel in any server?).
Tendency is to duplicate code between socket.io realm and your
business, fight against this.
Transport & messaging may be conditioning the
technology you use for your business logic
MADRID · NOV 27-28 · 2015
Also, may I suggest?
If you are going this path, check out Erlang/Elixir.
(btw, this is what we did)
MADRID · NOV 27-28 · 2015
Options available
(a lot)
MADRID · NOV 27-28 · 2015
Options
PAAS. Data-centric (talk to a NoSQL DB).
OpenSource. Extendible with node.js or Ruby code.
PAAS. PubSub channels. RT CDN Infrastructure.
Lots of SDKs in different languages.
Black box oriented.
OpenSource. PubSub channels. Black box oriented.
OpenSource. PubSub (&RPC). Platform oriented.
MADRID · NOV 27-28 · 2015
Black Box Approach
RT server like Nginx or Apache (no need to care wether Nginx is written in C
or Haskell?).
Conflict zones:
Authentication and Authorization: Implement in RT server vs in your
logic.
Communication between regular HTTP server in HTTP Request/Response
Fashion.
IMHO this makes sense.
(You may have other opinion
and that is cool)
MADRID · NOV 27-28 · 2015
How does it work: Client side
MADRID · NOV 27-28 · 2015
Publish to a channel
Carotene.publish({channel: "mychannel", message: "Hello world!"});
channel.trigger("message", "Hello world!");
pubnub.publish({
channel : "mychannel",
message : "Hello world!",
callback: function(m){ console.log(m); }
});
Carotene
Pusher
PubNub
Anything JSON-Serializable
MADRID · NOV 27-28 · 2015
Carotene
Subscribe to a channel
Carotene.subscribe({channel: "mychannel",
onMessage: function(message) {
console.log(message);
}
});
Pusher
PubNub
channel.bind('my-event', function(data) {
console.log(data.message);
});
PUBNUB.subscribe({
channel: 'my-channel',
message: function(m){console.log(m)}
});
MADRID · NOV 27-28 · 2015
Authentication: Who are you?
Carotene.authenticate({ userId: "some_user_identifier",
token: "token_for_this_user"
});
Carotene
Your server generates this
Check out JWT
[{carotene, [
% ... Other configuration options
{authenticate_url, "http://mybackend.com/authenticate_carotene/"}
}]}
Your server receives a POST request
MADRID · NOV 27-28 · 2015
[{carotene, [
% ... Other configuration options
{subscribe_authorization, [
{level, anonymous}
]},
}]}
Anonymous allowed
Authorization: Can you do that?
MADRID · NOV 27-28 · 2015
[{carotene, [
% ... Other configuration options
{subscribe_authorization, [
{level, authenticated}
]},
}]}
Only authenticated allowed
Authorization: Can you do that?
MADRID · NOV 27-28 · 2015
[{carotene, [
% ... Other configuration options
{level, ask},
{authorization_url, “http://mybackend.com/authorize-subscribe"}
]},
}]}
Let your logic decide
Publishing follows the same pattern
Authorization: Can you do that?
MADRID · NOV 27-28 · 2015
Examples
MADRID · NOV 27-28 · 2015
Simple chat
MADRID · NOV 27-28 · 2015
RT
#
subscribe({channel: “chat”})
#
subscribe({channel: “chat”})
#subscribe({channel: “chat”})
MADRID · NOV 27-28 · 2015
RT
#
publish({channel: “chat”, msg:”hi”})
#
message({channel: “chat”, msg: “hi”})
# message({channel: “chat”, msg: “hi”})
message({channel: “chat”, msg: “hi”})
MADRID · NOV 27-28 · 2015
Simple chat with logging
MADRID · NOV 27-28 · 2015
RT
#
#
#
!
subscribe({channel: “chat”})
regular HTTP
MADRID · NOV 27-28 · 2015
RT
#
#
message({channel: “chat”, msg: “hi”})
# message({channel: “chat”, msg: “hi”}) !
publish({channel: “chat”, msg:”hi”})
message({channel: “chat”, msg: “hi”}) message({
channel: “chat”,
msg: “hi”})
MADRID · NOV 27-28 · 2015
Customer “I want to filter out
telephone numbers and emails”
Ok
MADRID · NOV 27-28 · 2015
# subscribe({channel: “chat”})
#
subscribe({channel: “chat”})
#
subscribe({channel: “chat”})
RT
!
MADRID · NOV 27-28 · 2015
RT
!
#
#
#
$message({channel: “chat”, msg:”hi”})
message({channel: “chat”, msg:”hi”})
message({channel: “chat”, msg:”hi”})
publish({channel: “chat”, msg:”hi”})
Ajax
publish({
channel: “chat”,
msg:”hi”})
Http
MADRID · NOV 27-28 · 2015
Just because we have RT we
don’t need to stop using regular
HTTP
MADRID · NOV 27-28 · 2015
Notify in Real Time
vs notify per e-mail or mobile
MADRID · NOV 27-28 · 2015
RT
#
[Id: 9]
subscribe({channel: “user-9”})
!
%!
presence({channel: “user-9”})
presence([9]})
auth({user: 9, token: <token>})
& '
MADRID · NOV 27-28 · 2015
RT
#
[Id: 9] !send({channel: “user-9”,
message: <notification>})
message({channel: “user-9”,
message: <notification>})
& '
MADRID · NOV 27-28 · 2015
RT
!
%!
presence({channel: “user-9”})
presence([]})
& '
MADRID · NOV 27-28 · 2015
Broadcast news to everyone
(live scores, new comments, …)
MADRID · NOV 27-28 · 2015
RT
#
subscribe({channel: “page”})
#
subscribe({channel: “score”})
#subscribe({channel: “score”}) !
MADRID · NOV 27-28 · 2015
RT
#
#
message({channel: “score”, msg: “1:1”})
#message({channel: “score”, msg: “1:1”}) !
publish({
channel: “score”,
msg: “1:1”
})
regular HTTP
message({channel: “score”, msg: “1:1”})
This case scales very well
(no need to store much state in RT)
MADRID · NOV 27-28 · 2015
Do your tests
Very different possible scenarios. Benchmarks tend to test
the simplest case and brag about the number of
connections. (I like to do this too :).
Set up a load test with Tsung or Erlang+Gun to simulate
your use case:
• Expected #connections per channel
• Expected #msgs published per user
MADRID · NOV 27-28 · 2015
MADRID · NOV 27-28 · 2015
Thanks!
@nacmartin
nacho@limenius.com
http://carotene-project.com
http://limenius.com

Más contenido relacionado

Destacado

Dealing with large code bases. cd ams meetup
Dealing with large code bases. cd ams meetupDealing with large code bases. cd ams meetup
Dealing with large code bases. cd ams meetupViktor Sadovnikov
 
9 27-2012 -long
9 27-2012 -long9 27-2012 -long
9 27-2012 -longSky Lar
 
Social Media for Arts Service Organizations: No Strategy? No Time? No Staff? ...
Social Media for Arts Service Organizations: No Strategy? No Time? No Staff? ...Social Media for Arts Service Organizations: No Strategy? No Time? No Staff? ...
Social Media for Arts Service Organizations: No Strategy? No Time? No Staff? ...Sarah Page
 
Top 5 digital trends of 2016
Top 5 digital trends of 2016Top 5 digital trends of 2016
Top 5 digital trends of 2016Gianluca Girard
 
Responsive design in ten minutes
Responsive design in ten minutesResponsive design in ten minutes
Responsive design in ten minutesDotkumo
 
Certidão de Acervo Técnico EMURB-SP
Certidão de Acervo Técnico EMURB-SPCertidão de Acervo Técnico EMURB-SP
Certidão de Acervo Técnico EMURB-SPGladston Bernardi
 
Why hardware accelerator matters
Why hardware accelerator mattersWhy hardware accelerator matters
Why hardware accelerator mattersLman Chu
 
poverty by Armghan Arshad
poverty by Armghan Arshadpoverty by Armghan Arshad
poverty by Armghan Arshadkaka ptaka
 
200810 Communities&Conversations
200810 Communities&Conversations200810 Communities&Conversations
200810 Communities&ConversationsRob Inskeep
 

Destacado (14)

Dealing with large code bases. cd ams meetup
Dealing with large code bases. cd ams meetupDealing with large code bases. cd ams meetup
Dealing with large code bases. cd ams meetup
 
9 27-2012 -long
9 27-2012 -long9 27-2012 -long
9 27-2012 -long
 
Social Media for Artistic People
Social Media for Artistic PeopleSocial Media for Artistic People
Social Media for Artistic People
 
Beepi and Digital Dealer
Beepi and Digital DealerBeepi and Digital Dealer
Beepi and Digital Dealer
 
Social Media for Arts Service Organizations: No Strategy? No Time? No Staff? ...
Social Media for Arts Service Organizations: No Strategy? No Time? No Staff? ...Social Media for Arts Service Organizations: No Strategy? No Time? No Staff? ...
Social Media for Arts Service Organizations: No Strategy? No Time? No Staff? ...
 
PerfilInnews
PerfilInnewsPerfilInnews
PerfilInnews
 
Burnette - Building a culture of trust
Burnette - Building a culture of trust Burnette - Building a culture of trust
Burnette - Building a culture of trust
 
Top 5 digital trends of 2016
Top 5 digital trends of 2016Top 5 digital trends of 2016
Top 5 digital trends of 2016
 
Responsive design in ten minutes
Responsive design in ten minutesResponsive design in ten minutes
Responsive design in ten minutes
 
Certidão de Acervo Técnico EMURB-SP
Certidão de Acervo Técnico EMURB-SPCertidão de Acervo Técnico EMURB-SP
Certidão de Acervo Técnico EMURB-SP
 
Why hardware accelerator matters
Why hardware accelerator mattersWhy hardware accelerator matters
Why hardware accelerator matters
 
poverty by Armghan Arshad
poverty by Armghan Arshadpoverty by Armghan Arshad
poverty by Armghan Arshad
 
200810 Communities&Conversations
200810 Communities&Conversations200810 Communities&Conversations
200810 Communities&Conversations
 
2015 Intellectual Property (IP) Year in Review
2015 Intellectual Property (IP) Year in Review2015 Intellectual Property (IP) Year in Review
2015 Intellectual Property (IP) Year in Review
 

Similar a Adding Realtime to your Projects

DAY1- DAY2Netweaver gateway
DAY1- DAY2Netweaver gatewayDAY1- DAY2Netweaver gateway
DAY1- DAY2Netweaver gatewayGaurav Ahluwalia
 
Meetup OpenTelemetry Intro
Meetup OpenTelemetry IntroMeetup OpenTelemetry Intro
Meetup OpenTelemetry IntroDimitrisFinas1
 
Connect Everything with NATS - Cloud Expo Europe
Connect Everything with NATS - Cloud Expo EuropeConnect Everything with NATS - Cloud Expo Europe
Connect Everything with NATS - Cloud Expo Europewallyqs
 
EWD.js: The Future Starts Here
EWD.js: The Future Starts HereEWD.js: The Future Starts Here
EWD.js: The Future Starts HereRob Tweed
 
Who's Who in Container Land
Who's Who in Container LandWho's Who in Container Land
Who's Who in Container LandMike Kavis
 
PRIVATE CLOUD SERVER IMPLEMENTATIONS FOR DATA STORAGE
PRIVATE CLOUD SERVER IMPLEMENTATIONS FOR DATA STORAGEPRIVATE CLOUD SERVER IMPLEMENTATIONS FOR DATA STORAGE
PRIVATE CLOUD SERVER IMPLEMENTATIONS FOR DATA STORAGEEditor IJCTER
 
Highway to heaven - Microservices Meetup Munich
Highway to heaven - Microservices Meetup MunichHighway to heaven - Microservices Meetup Munich
Highway to heaven - Microservices Meetup MunichChristian Deger
 
Cloud and Enterprise Tools – Rob Purdy, General Manager, Datacom
Cloud and Enterprise Tools – Rob Purdy, General Manager, DatacomCloud and Enterprise Tools – Rob Purdy, General Manager, Datacom
Cloud and Enterprise Tools – Rob Purdy, General Manager, DatacomAmazon Web Services
 
NATS: Control Flow for Distributed Systems
NATS: Control Flow for Distributed SystemsNATS: Control Flow for Distributed Systems
NATS: Control Flow for Distributed SystemsApcera
 
Using NATS for Control Flow in Distributed Systems
Using NATS for Control Flow in Distributed SystemsUsing NATS for Control Flow in Distributed Systems
Using NATS for Control Flow in Distributed SystemsNATS
 
Ymens - Bouncing off clouds - Rapid Development for Cloud Ready Applications...
Ymens - Bouncing off clouds - Rapid Development for Cloud Ready Applications...Ymens - Bouncing off clouds - Rapid Development for Cloud Ready Applications...
Ymens - Bouncing off clouds - Rapid Development for Cloud Ready Applications...Vlad Mihnea
 
Кирилл Толкачев. Микросервисы: огонь, вода и девопс
Кирилл Толкачев. Микросервисы: огонь, вода и девопсКирилл Толкачев. Микросервисы: огонь, вода и девопс
Кирилл Толкачев. Микросервисы: огонь, вода и девопсScrumTrek
 
Microservices with Node.js and Apache Cassandra
Microservices with Node.js and Apache CassandraMicroservices with Node.js and Apache Cassandra
Microservices with Node.js and Apache CassandraJorge Bay Gondra
 
Automated SDTM Creation and Discrepancy Detection Jobs: The Numbers Tell The ...
Automated SDTM Creation and Discrepancy Detection Jobs: The Numbers Tell The ...Automated SDTM Creation and Discrepancy Detection Jobs: The Numbers Tell The ...
Automated SDTM Creation and Discrepancy Detection Jobs: The Numbers Tell The ...SGS
 
Seven Criteria for Building an AWS Global Transit Network
Seven Criteria for Building an AWS Global Transit NetworkSeven Criteria for Building an AWS Global Transit Network
Seven Criteria for Building an AWS Global Transit NetworkKhash Nakhostin
 
20151119 Sensibilisation des Utilisateurs aux coûts d'usage du Cloud
20151119 Sensibilisation des Utilisateurs aux coûts d'usage du Cloud20151119 Sensibilisation des Utilisateurs aux coûts d'usage du Cloud
20151119 Sensibilisation des Utilisateurs aux coûts d'usage du CloudObjectif Libre
 

Similar a Adding Realtime to your Projects (20)

DAY1- DAY2Netweaver gateway
DAY1- DAY2Netweaver gatewayDAY1- DAY2Netweaver gateway
DAY1- DAY2Netweaver gateway
 
Meetup OpenTelemetry Intro
Meetup OpenTelemetry IntroMeetup OpenTelemetry Intro
Meetup OpenTelemetry Intro
 
Connect Everything with NATS - Cloud Expo Europe
Connect Everything with NATS - Cloud Expo EuropeConnect Everything with NATS - Cloud Expo Europe
Connect Everything with NATS - Cloud Expo Europe
 
2015 Q4 webrtc standards update
2015 Q4 webrtc standards update2015 Q4 webrtc standards update
2015 Q4 webrtc standards update
 
EWD.js: The Future Starts Here
EWD.js: The Future Starts HereEWD.js: The Future Starts Here
EWD.js: The Future Starts Here
 
Who's Who in Container Land
Who's Who in Container LandWho's Who in Container Land
Who's Who in Container Land
 
PRIVATE CLOUD SERVER IMPLEMENTATIONS FOR DATA STORAGE
PRIVATE CLOUD SERVER IMPLEMENTATIONS FOR DATA STORAGEPRIVATE CLOUD SERVER IMPLEMENTATIONS FOR DATA STORAGE
PRIVATE CLOUD SERVER IMPLEMENTATIONS FOR DATA STORAGE
 
Highway to heaven - Microservices Meetup Munich
Highway to heaven - Microservices Meetup MunichHighway to heaven - Microservices Meetup Munich
Highway to heaven - Microservices Meetup Munich
 
Cloud and Enterprise Tools – Rob Purdy, General Manager, Datacom
Cloud and Enterprise Tools – Rob Purdy, General Manager, DatacomCloud and Enterprise Tools – Rob Purdy, General Manager, Datacom
Cloud and Enterprise Tools – Rob Purdy, General Manager, Datacom
 
NATS: Control Flow for Distributed Systems
NATS: Control Flow for Distributed SystemsNATS: Control Flow for Distributed Systems
NATS: Control Flow for Distributed Systems
 
Using NATS for Control Flow in Distributed Systems
Using NATS for Control Flow in Distributed SystemsUsing NATS for Control Flow in Distributed Systems
Using NATS for Control Flow in Distributed Systems
 
Deploy prometheus on kubernetes
Deploy prometheus on kubernetesDeploy prometheus on kubernetes
Deploy prometheus on kubernetes
 
Ymens - Bouncing off clouds - Rapid Development for Cloud Ready Applications...
Ymens - Bouncing off clouds - Rapid Development for Cloud Ready Applications...Ymens - Bouncing off clouds - Rapid Development for Cloud Ready Applications...
Ymens - Bouncing off clouds - Rapid Development for Cloud Ready Applications...
 
Кирилл Толкачев. Микросервисы: огонь, вода и девопс
Кирилл Толкачев. Микросервисы: огонь, вода и девопсКирилл Толкачев. Микросервисы: огонь, вода и девопс
Кирилл Толкачев. Микросервисы: огонь, вода и девопс
 
Cloud Computing basic
Cloud Computing basicCloud Computing basic
Cloud Computing basic
 
Microservices with Node.js and Apache Cassandra
Microservices with Node.js and Apache CassandraMicroservices with Node.js and Apache Cassandra
Microservices with Node.js and Apache Cassandra
 
Automated SDTM Creation and Discrepancy Detection Jobs: The Numbers Tell The ...
Automated SDTM Creation and Discrepancy Detection Jobs: The Numbers Tell The ...Automated SDTM Creation and Discrepancy Detection Jobs: The Numbers Tell The ...
Automated SDTM Creation and Discrepancy Detection Jobs: The Numbers Tell The ...
 
Seven Criteria for Building an AWS Global Transit Network
Seven Criteria for Building an AWS Global Transit NetworkSeven Criteria for Building an AWS Global Transit Network
Seven Criteria for Building an AWS Global Transit Network
 
Playing with kubernetes, istio and kiali
Playing with kubernetes, istio and kialiPlaying with kubernetes, istio and kiali
Playing with kubernetes, istio and kiali
 
20151119 Sensibilisation des Utilisateurs aux coûts d'usage du Cloud
20151119 Sensibilisation des Utilisateurs aux coûts d'usage du Cloud20151119 Sensibilisation des Utilisateurs aux coûts d'usage du Cloud
20151119 Sensibilisation des Utilisateurs aux coûts d'usage du Cloud
 

Más de Ignacio Martín

Elixir/OTP for PHP developers
Elixir/OTP for PHP developersElixir/OTP for PHP developers
Elixir/OTP for PHP developersIgnacio Martín
 
Introduction to React Native Workshop
Introduction to React Native WorkshopIntroduction to React Native Workshop
Introduction to React Native WorkshopIgnacio Martín
 
Server side rendering with React and Symfony
Server side rendering with React and SymfonyServer side rendering with React and Symfony
Server side rendering with React and SymfonyIgnacio Martín
 
Symfony 4 Workshop - Limenius
Symfony 4 Workshop - LimeniusSymfony 4 Workshop - Limenius
Symfony 4 Workshop - LimeniusIgnacio Martín
 
Server Side Rendering of JavaScript in PHP
Server Side Rendering of JavaScript in PHPServer Side Rendering of JavaScript in PHP
Server Side Rendering of JavaScript in PHPIgnacio Martín
 
Extending Redux in the Server Side
Extending Redux in the Server SideExtending Redux in the Server Side
Extending Redux in the Server SideIgnacio Martín
 
Redux Sagas - React Alicante
Redux Sagas - React AlicanteRedux Sagas - React Alicante
Redux Sagas - React AlicanteIgnacio Martín
 
React Native Workshop - React Alicante
React Native Workshop - React AlicanteReact Native Workshop - React Alicante
React Native Workshop - React AlicanteIgnacio Martín
 
Asegurando APIs en Symfony con JWT
Asegurando APIs en Symfony con JWTAsegurando APIs en Symfony con JWT
Asegurando APIs en Symfony con JWTIgnacio Martín
 
Redux saga: managing your side effects. Also: generators in es6
Redux saga: managing your side effects. Also: generators in es6Redux saga: managing your side effects. Also: generators in es6
Redux saga: managing your side effects. Also: generators in es6Ignacio Martín
 
Integrating React.js with PHP projects
Integrating React.js with PHP projectsIntegrating React.js with PHP projects
Integrating React.js with PHP projectsIgnacio Martín
 
Keeping the frontend under control with Symfony and Webpack
Keeping the frontend under control with Symfony and WebpackKeeping the frontend under control with Symfony and Webpack
Keeping the frontend under control with Symfony and WebpackIgnacio Martín
 
Integrando React.js en aplicaciones Symfony (deSymfony 2016)
Integrando React.js en aplicaciones Symfony (deSymfony 2016)Integrando React.js en aplicaciones Symfony (deSymfony 2016)
Integrando React.js en aplicaciones Symfony (deSymfony 2016)Ignacio Martín
 
Symfony & Javascript. Combining the best of two worlds
Symfony & Javascript. Combining the best of two worldsSymfony & Javascript. Combining the best of two worlds
Symfony & Javascript. Combining the best of two worldsIgnacio Martín
 

Más de Ignacio Martín (17)

Elixir/OTP for PHP developers
Elixir/OTP for PHP developersElixir/OTP for PHP developers
Elixir/OTP for PHP developers
 
Introduction to React Native Workshop
Introduction to React Native WorkshopIntroduction to React Native Workshop
Introduction to React Native Workshop
 
Server side rendering with React and Symfony
Server side rendering with React and SymfonyServer side rendering with React and Symfony
Server side rendering with React and Symfony
 
Symfony 4 Workshop - Limenius
Symfony 4 Workshop - LimeniusSymfony 4 Workshop - Limenius
Symfony 4 Workshop - Limenius
 
Server Side Rendering of JavaScript in PHP
Server Side Rendering of JavaScript in PHPServer Side Rendering of JavaScript in PHP
Server Side Rendering of JavaScript in PHP
 
Extending Redux in the Server Side
Extending Redux in the Server SideExtending Redux in the Server Side
Extending Redux in the Server Side
 
Redux Sagas - React Alicante
Redux Sagas - React AlicanteRedux Sagas - React Alicante
Redux Sagas - React Alicante
 
React Native Workshop - React Alicante
React Native Workshop - React AlicanteReact Native Workshop - React Alicante
React Native Workshop - React Alicante
 
Asegurando APIs en Symfony con JWT
Asegurando APIs en Symfony con JWTAsegurando APIs en Symfony con JWT
Asegurando APIs en Symfony con JWT
 
Redux saga: managing your side effects. Also: generators in es6
Redux saga: managing your side effects. Also: generators in es6Redux saga: managing your side effects. Also: generators in es6
Redux saga: managing your side effects. Also: generators in es6
 
Integrating React.js with PHP projects
Integrating React.js with PHP projectsIntegrating React.js with PHP projects
Integrating React.js with PHP projects
 
Introduction to Redux
Introduction to ReduxIntroduction to Redux
Introduction to Redux
 
Keeping the frontend under control with Symfony and Webpack
Keeping the frontend under control with Symfony and WebpackKeeping the frontend under control with Symfony and Webpack
Keeping the frontend under control with Symfony and Webpack
 
Integrando React.js en aplicaciones Symfony (deSymfony 2016)
Integrando React.js en aplicaciones Symfony (deSymfony 2016)Integrando React.js en aplicaciones Symfony (deSymfony 2016)
Integrando React.js en aplicaciones Symfony (deSymfony 2016)
 
Symfony & Javascript. Combining the best of two worlds
Symfony & Javascript. Combining the best of two worldsSymfony & Javascript. Combining the best of two worlds
Symfony & Javascript. Combining the best of two worlds
 
Symfony 2 CMF
Symfony 2 CMFSymfony 2 CMF
Symfony 2 CMF
 
Presentacion git
Presentacion gitPresentacion git
Presentacion git
 

Último

Wadgaon Sheri $ Call Girls Pune 10k @ I'm VIP Independent Escorts Girls 80057...
Wadgaon Sheri $ Call Girls Pune 10k @ I'm VIP Independent Escorts Girls 80057...Wadgaon Sheri $ Call Girls Pune 10k @ I'm VIP Independent Escorts Girls 80057...
Wadgaon Sheri $ Call Girls Pune 10k @ I'm VIP Independent Escorts Girls 80057...SUHANI PANDEY
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdfMatthew Sinclair
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)Delhi Call girls
 
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdfMatthew Sinclair
 
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...SUHANI PANDEY
 
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls DubaiDubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubaikojalkojal131
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableSeo
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirtrahman018755
 
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...SUHANI PANDEY
 
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrStory Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrHenryBriggs2
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查ydyuyu
 
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort ServiceBusty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort ServiceDelhi Call girls
 
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445ruhi
 
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Delhi Call girls
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...singhpriety023
 
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...kajalverma014
 
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency""Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency"growthgrids
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtrahman018755
 

Último (20)

Wadgaon Sheri $ Call Girls Pune 10k @ I'm VIP Independent Escorts Girls 80057...
Wadgaon Sheri $ Call Girls Pune 10k @ I'm VIP Independent Escorts Girls 80057...Wadgaon Sheri $ Call Girls Pune 10k @ I'm VIP Independent Escorts Girls 80057...
Wadgaon Sheri $ Call Girls Pune 10k @ I'm VIP Independent Escorts Girls 80057...
 
📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱
📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱
📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
 
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
 
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
 
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls DubaiDubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
 
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirt
 
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
 
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrStory Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
 
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort ServiceBusty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
 
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
 
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
 
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
 
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency""Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 

Adding Realtime to your Projects

  • 1. MADRID · NOV 27-28 · 2015 Adding Realtime To your Apps Nacho Martín
  • 2. MADRID · NOV 27-28 · 2015 I write software at limenius.com 3/4 of them need some form of Real Time We build web and mobile apps for clients We have tried many things in different battles This year we abstracted carotene-project.com and opensourced it
  • 3. MADRID · NOV 27-28 · 2015 A bit of history Websockets? where we are going we don’t need Websockets
  • 4. MADRID · NOV 27-28 · 2015 Meet Tim Berners-Lee, 1991
  • 5. MADRID · NOV 27-28 · 2015 He worked at CERN CERN’s ideas are rooted in 18th century Enlightenment
  • 6. MADRID · NOV 27-28 · 2015 Most important: knowledge
  • 7. MADRID · NOV 27-28 · 2015 Humans pass knowledge to next generations!
  • 8. MADRID · NOV 27-28 · 2015 We stand on the shoulders of giants!
  • 9. MADRID · NOV 27-28 · 2015 Result: The Very First Web It is about documents
  • 10. MADRID · NOV 27-28 · 2015 Under this hypothesis 1% 99% Produced before request Produced right now: 1%? Probably more like 0.0000001% Human Knowledge
  • 11. MADRID · NOV 27-28 · 2015 Corollary: If something important happens after the HTTP request, it will be filtered and solidified in Knowledge and preserved for ages! Come again next month.
  • 12. MADRID · NOV 27-28 · 2015 At CERN they build things pretty well
  • 13. MADRID · NOV 27-28 · 2015 Archie News Irc Gopher email WEBFtp
  • 14. MADRID · NOV 27-28 · 2015 Under the document paradigm
  • 15. MADRID · NOV 27-28 · 2015 Process a Request, call a program serve a Response Serve a Document Under the document paradigm Short lived processes Under the document paradigm
  • 16. MADRID · NOV 27-28 · 2015 CGI was born And then… PHP Rails Django Symfony Wordpress MediaWiki Spring CakePHP Perl-cgi Code Igniter Laravel
  • 17. MADRID · NOV 27-28 · 2015 This scales very well ! ! ! ! !   And has been VERY battle tested
  • 18. MADRID · NOV 27-28 · 2015 25 years have passed Humanity has been exposed to huge loads of information Time to check the enlightement hypothesis What do people express more interest at?
  • 19. MADRID · NOV 27-28 · 2015
  • 20. MADRID · NOV 27-28 · 2015 Meet Tim Berners-Lee, 2015
  • 21. MADRID · NOV 27-28 · 2015 In face of this sad truth What to do as a developer?
  • 22. MADRID · NOV 27-28 · 2015 Possibility 1 (Has chances of doing something meaningful and be rememebered)
  • 23. MADRID · NOV 27-28 · 2015 Let’s explore possibility 2
  • 24. MADRID · NOV 27-28 · 2015 At CERN they build things toowell!
  • 25. MADRID · NOV 27-28 · 2015 Stretching the paradigm Backend Html JavaScript
  • 26. MADRID · NOV 27-28 · 2015 Stretching the paradigm Backend Html JavaScript API
  • 27. MADRID · NOV 27-28 · 2015 Not what it was built for Request overhead Granularity compromise: Requests/min vs Resources Chaining events: waiting times add up. IoT capable? Like asking for a video one frame at a time
  • 28. MADRID · NOV 27-28 · 2015 What do we mean by Real Time
  • 29. MADRID · NOV 27-28 · 2015 Hard Real Time Maximum response time guaranteed We won’t talk about this
  • 30. MADRID · NOV 27-28 · 2015 Soft Real Time Reasonable response time Normally based on human perception
  • 31. MADRID · NOV 27-28 · 2015 Soft Real Time For information that loses value with time
  • 32. MADRID · NOV 27-28 · 2015 Value with time Your neighbour starts screaming
  • 33. MADRID · NOV 27-28 · 2015 Use cases where RT is more beneficial
  • 34. MADRID · NOV 27-28 · 2015 Analytics
  • 35. MADRID · NOV 27-28 · 2015
  • 36. MADRID · NOV 27-28 · 2015 Gaming
  • 37. MADRID · NOV 27-28 · 2015 Social & Messaging
  • 38. MADRID · NOV 27-28 · 2015 Collaboration
  • 39. MADRID · NOV 27-28 · 2015 Amazon Customer Service
  • 40. MADRID · NOV 27-28 · 2015 Basically, the less your app looks like this
  • 41. MADRID · NOV 27-28 · 2015 For how long can we live in a past paradigm? Kano model
  • 42. MADRID · NOV 27-28 · 2015 Architecture
  • 43. MADRID · NOV 27-28 · 2015 WebSockets, what are they Hack (Standarized, but hack) to turn HTTP back into a TCP full-duplex connection and call it “upgrade”. GET /chat HTTP/1.1 Host: server.example.com Upgrade: WebSocket Connection: Upgrade Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ== Origin: http://example.com Sec-WebSocket-Version: 13 HTTP/1.1 101 Switching Protocols Upgrade: WebSocket Connection: Upgrade Sec-WebSocket-Accept: s3pPL<…>Oo=
  • 44. MADRID · NOV 27-28 · 2015 Can I use Websockets? 88.17%
  • 45. MADRID · NOV 27-28 · 2015 But Long polling… Make an Ajax Request, leave it open waiting for a Response. Introduces complexity: group chained requests into “connections”. Needs buffering handling. Adds complexity to support the remaining 11.83%.
  • 46. MADRID · NOV 27-28 · 2015 Three layers-model Transport Messaging Data Sync Regular HTTP HTTP Request/Response Probably your work Real Time Websockets (or Long polling) Publish/Subscribe (or RPC) Probably your work
  • 47. MADRID · NOV 27-28 · 2015 There is a fourth layer Everything our tech model cannot handle, our brain has to make up for it
  • 48. MADRID · NOV 27-28 · 2015
  • 49. MADRID · NOV 27-28 · 2015 F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5!!!!!!! Human dealing with a protocol that doesn’t map reality well
  • 50. MADRID · NOV 27-28 · 2015 Three layers-model Transport Messaging Data Sync Core of the product Where you add value Implemented in a language you know well
  • 51. MADRID · NOV 27-28 · 2015 Three layers-model Transport Messaging Data Sync Implemented in a technology very performant Don’t mix your business logic with it
  • 52. MADRID · NOV 27-28 · 2015 Aim for Transport Messaging Data Sync Regular HTTP Your work Real Time Your work Nginx/Apache RT Server
  • 53. MADRID · NOV 27-28 · 2015
  • 54. MADRID · NOV 27-28 · 2015 DIY approach (typically socket.io) Tutorial looks super easy, but: Soon you realise that you must deal with messaging details (who is in a channel? how to do auth?). Multi-server environments are up to you (how to know if a user is connected in a channel in any server?). Tendency is to duplicate code between socket.io realm and your business, fight against this. Transport & messaging may be conditioning the technology you use for your business logic
  • 55. MADRID · NOV 27-28 · 2015 Also, may I suggest? If you are going this path, check out Erlang/Elixir. (btw, this is what we did)
  • 56. MADRID · NOV 27-28 · 2015 Options available (a lot)
  • 57. MADRID · NOV 27-28 · 2015 Options PAAS. Data-centric (talk to a NoSQL DB). OpenSource. Extendible with node.js or Ruby code. PAAS. PubSub channels. RT CDN Infrastructure. Lots of SDKs in different languages. Black box oriented. OpenSource. PubSub channels. Black box oriented. OpenSource. PubSub (&RPC). Platform oriented.
  • 58. MADRID · NOV 27-28 · 2015 Black Box Approach RT server like Nginx or Apache (no need to care wether Nginx is written in C or Haskell?). Conflict zones: Authentication and Authorization: Implement in RT server vs in your logic. Communication between regular HTTP server in HTTP Request/Response Fashion. IMHO this makes sense. (You may have other opinion and that is cool)
  • 59. MADRID · NOV 27-28 · 2015 How does it work: Client side
  • 60. MADRID · NOV 27-28 · 2015 Publish to a channel Carotene.publish({channel: "mychannel", message: "Hello world!"}); channel.trigger("message", "Hello world!"); pubnub.publish({ channel : "mychannel", message : "Hello world!", callback: function(m){ console.log(m); } }); Carotene Pusher PubNub Anything JSON-Serializable
  • 61. MADRID · NOV 27-28 · 2015 Carotene Subscribe to a channel Carotene.subscribe({channel: "mychannel", onMessage: function(message) { console.log(message); } }); Pusher PubNub channel.bind('my-event', function(data) { console.log(data.message); }); PUBNUB.subscribe({ channel: 'my-channel', message: function(m){console.log(m)} });
  • 62. MADRID · NOV 27-28 · 2015 Authentication: Who are you? Carotene.authenticate({ userId: "some_user_identifier", token: "token_for_this_user" }); Carotene Your server generates this Check out JWT [{carotene, [ % ... Other configuration options {authenticate_url, "http://mybackend.com/authenticate_carotene/"} }]} Your server receives a POST request
  • 63. MADRID · NOV 27-28 · 2015 [{carotene, [ % ... Other configuration options {subscribe_authorization, [ {level, anonymous} ]}, }]} Anonymous allowed Authorization: Can you do that?
  • 64. MADRID · NOV 27-28 · 2015 [{carotene, [ % ... Other configuration options {subscribe_authorization, [ {level, authenticated} ]}, }]} Only authenticated allowed Authorization: Can you do that?
  • 65. MADRID · NOV 27-28 · 2015 [{carotene, [ % ... Other configuration options {level, ask}, {authorization_url, “http://mybackend.com/authorize-subscribe"} ]}, }]} Let your logic decide Publishing follows the same pattern Authorization: Can you do that?
  • 66. MADRID · NOV 27-28 · 2015 Examples
  • 67. MADRID · NOV 27-28 · 2015 Simple chat
  • 68. MADRID · NOV 27-28 · 2015 RT # subscribe({channel: “chat”}) # subscribe({channel: “chat”}) #subscribe({channel: “chat”})
  • 69. MADRID · NOV 27-28 · 2015 RT # publish({channel: “chat”, msg:”hi”}) # message({channel: “chat”, msg: “hi”}) # message({channel: “chat”, msg: “hi”}) message({channel: “chat”, msg: “hi”})
  • 70. MADRID · NOV 27-28 · 2015 Simple chat with logging
  • 71. MADRID · NOV 27-28 · 2015 RT # # # ! subscribe({channel: “chat”}) regular HTTP
  • 72. MADRID · NOV 27-28 · 2015 RT # # message({channel: “chat”, msg: “hi”}) # message({channel: “chat”, msg: “hi”}) ! publish({channel: “chat”, msg:”hi”}) message({channel: “chat”, msg: “hi”}) message({ channel: “chat”, msg: “hi”})
  • 73. MADRID · NOV 27-28 · 2015 Customer “I want to filter out telephone numbers and emails” Ok
  • 74. MADRID · NOV 27-28 · 2015 # subscribe({channel: “chat”}) # subscribe({channel: “chat”}) # subscribe({channel: “chat”}) RT !
  • 75. MADRID · NOV 27-28 · 2015 RT ! # # # $message({channel: “chat”, msg:”hi”}) message({channel: “chat”, msg:”hi”}) message({channel: “chat”, msg:”hi”}) publish({channel: “chat”, msg:”hi”}) Ajax publish({ channel: “chat”, msg:”hi”}) Http
  • 76. MADRID · NOV 27-28 · 2015 Just because we have RT we don’t need to stop using regular HTTP
  • 77. MADRID · NOV 27-28 · 2015 Notify in Real Time vs notify per e-mail or mobile
  • 78. MADRID · NOV 27-28 · 2015 RT # [Id: 9] subscribe({channel: “user-9”}) ! %! presence({channel: “user-9”}) presence([9]}) auth({user: 9, token: <token>}) & '
  • 79. MADRID · NOV 27-28 · 2015 RT # [Id: 9] !send({channel: “user-9”, message: <notification>}) message({channel: “user-9”, message: <notification>}) & '
  • 80. MADRID · NOV 27-28 · 2015 RT ! %! presence({channel: “user-9”}) presence([]}) & '
  • 81. MADRID · NOV 27-28 · 2015 Broadcast news to everyone (live scores, new comments, …)
  • 82. MADRID · NOV 27-28 · 2015 RT # subscribe({channel: “page”}) # subscribe({channel: “score”}) #subscribe({channel: “score”}) !
  • 83. MADRID · NOV 27-28 · 2015 RT # # message({channel: “score”, msg: “1:1”}) #message({channel: “score”, msg: “1:1”}) ! publish({ channel: “score”, msg: “1:1” }) regular HTTP message({channel: “score”, msg: “1:1”}) This case scales very well (no need to store much state in RT)
  • 84. MADRID · NOV 27-28 · 2015 Do your tests Very different possible scenarios. Benchmarks tend to test the simplest case and brag about the number of connections. (I like to do this too :). Set up a load test with Tsung or Erlang+Gun to simulate your use case: • Expected #connections per channel • Expected #msgs published per user
  • 85. MADRID · NOV 27-28 · 2015
  • 86. MADRID · NOV 27-28 · 2015 Thanks! @nacmartin nacho@limenius.com http://carotene-project.com http://limenius.com