Realtime Web Applications wit ExpressJS
Hüseyin BABAL
Software Developer, CSM
@Sony Eurasia
A Scenario...
Plane status board…
Updating board on every flight
Check flight status for every
second?
Let’s code that board software...
Good Code, but this is
something like...
Yeah, client side
server bombing...
It would be better if
server side inform
client on any update...
What is SocketIO?
●
●
●
●

Care-Free realtime 100% Javascript
Cross-Browser and mobile device
Wrapper for the Websocket
Learnboost
Go back to origin...
Websocket?
●
●
●
●

Full-duplex comm. channels over TCP
Only its handshake interpreted by HTTP servers
Push server data to client browser
80 port and no firewall prevent
Handshake
Clients sends base64 encoded string
Server appends a magic string to it and encrypt
SHA-1 after then base64
Example...
Client: x3JJHMbDL1EzLkh9GBhXDw==
Server:
x3JJHMbDL1EzLkh9GBhXDw==258EAFA5E914-47DA-95CA-C5AB0DC85B11 then SHA1.
base64(above appended string) =
HSmrc0sMlYUkAGmm5OPpG2HaGWk=
In SocketIO, you don’t
need to know all this
stuffs
Send / Receive Events
Store client data
Namespace
Volatile Messaging
Acknowledgement
Broadcasting
Quickies
ExpressJS

https://github.com/visionmedia/express

SocketIO

https://github.com/LearnBoost/socket.io

Learnboost

https://github.com/LearnBoost

Websockets

http://en.wikipedia.org/wiki/WebSocket

Button Click Game

http://btnclick.herokuapp.com/signin

Heroku Websockets

https://blog.heroku.com/archives/2013/10/8/websockets-public-beta
Mobile?
Will Be Demonstrated
on Next BBS
Thanks

Realtime web applications with ExpressJS and SocketIO