real time realitites

27
Real Time Realities!!! Adding Real Time support to Your web app Kausikram Krishnasayee Silver Stripe Software

Upload: markisuak

Post on 13-Jul-2015

152 views

Category:

Technology


0 download

TRANSCRIPT

Real Time Realities!!!

Adding Real Time support to Your web app

Kausikram KrishnasayeeSilver Stripe Software

The History

The Steps

● Step 0 – get your code ready for real-time.● Step 1 – lets start with some Websockets.● Step 2 – lets show the same love to some old browsers.● Step 3 – Real-time strategies, to make life easy.● Step 4 – Deployment, Scalability and Hair loss.

Code Is a Mess.

Truck factor is 1.

Business Logic, Data and Rendering are all tied up.

Testing is hard. Feature Addition is Harder...

There ARE going to be bugs....

Step 0

De Couple Logic, Data and Rendering (MVC)

Lets look at the code again ...

Step 0

● Code is much more cleaner● Code is easily testable● Change in logic, data schema and rendering

is easy.● Adding new functionality is easy.

Step 0

Step 1: websockets

Bring in Real Time Support for browsers which support the awesome HTML5 websocket spec.

Write a fail safe for Browsers written for our forefathers.

Step 1

Note about Technologies used

● Tornado running on a different port which basically echos back data to all concurrent connections

● Using the native websocket JS api to make connections and update changes when there is a model change taking place.

● Do nothing when on IE, if possible intimidate the user.

Step 1

How to intimidate users nicely

Lets look at the code again ...

Step 1

● Real-time backend server running on a different port

● Full real-time support for new browsers● No real-time support for old browsers

Step 1

If you hate IE users you can stop here....

Step 1

Step 2 : Full Real-time support

Use a combination of comet, Web sockets, flash, and any other possible technology that is possible

to create a cross browser, almost similar functioning realtime system.

Note on technology

● Comet: doing non HTTP things through HTTP ways...

● Socket.io or js.io or something similar in the front end.

● Socket.io / servers implementing connection negotiation mechanisms in the backend.

Step 2

● Support for real Real-time even on IE 6.● Abstracted out API to perform real-time actions.● Peace of mind.

Step 2

Step 3: pub sub systems● What if there are more than one task list?● How about activities performed through the

API?● How about having a need to authenticate ?

Note on technology● Hookbox, Juggernaut or any other channel

based pub-sub system● I wrote one myself :D

Step 3

Note on technology (Cont'd)Backend to Live Server Connection.

Step 3

Server

LS

Server

LS

Step 4: Deploy, Scale and much more

● Running the LS on a different port is not a great idea.

● How about handling a few hundred connections at the same time? What if you get Tech Crunched ?

● What is the fall back option if LS crashes.

Step 4

Thank You !!