Realtime web applications with ExpressJS and SocketIO

1,117 views

Published on

Realtime web applications with ExpressJS and SocketIO. Also best practises

Published in: Technology
1 Comment
1 Like
Statistics
Notes
No Downloads
Views
Total views
1,117
On SlideShare
0
From Embeds
0
Number of Embeds
21
Actions
Shares
0
Downloads
29
Comments
1
Likes
1
Embeds 0
No embeds

No notes for slide

Realtime web applications with ExpressJS and SocketIO

  1. 1. Realtime Web Applications wit ExpressJS Hüseyin BABAL Software Developer, CSM @Sony Eurasia
  2. 2. A Scenario...
  3. 3. Plane status board… Updating board on every flight Check flight status for every second? Let’s code that board software...
  4. 4. Good Code, but this is something like...
  5. 5. Yeah, client side server bombing...
  6. 6. It would be better if server side inform client on any update...
  7. 7. What is SocketIO?
  8. 8. ● ● ● ● Care-Free realtime 100% Javascript Cross-Browser and mobile device Wrapper for the Websocket Learnboost
  9. 9. Go back to origin...
  10. 10. 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
  11. 11. Handshake
  12. 12. Clients sends base64 encoded string Server appends a magic string to it and encrypt SHA-1 after then base64 Example...
  13. 13. Client: x3JJHMbDL1EzLkh9GBhXDw== Server: x3JJHMbDL1EzLkh9GBhXDw==258EAFA5E914-47DA-95CA-C5AB0DC85B11 then SHA1. base64(above appended string) = HSmrc0sMlYUkAGmm5OPpG2HaGWk=
  14. 14. In SocketIO, you don’t need to know all this stuffs
  15. 15. Send / Receive Events
  16. 16. Store client data
  17. 17. Namespace
  18. 18. Volatile Messaging
  19. 19. Acknowledgement
  20. 20. Broadcasting
  21. 21. 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
  22. 22. Mobile? Will Be Demonstrated on Next BBS
  23. 23. Thanks

×