[FT-8][banacorn] Socket.IO for Haskell Folks

1,131 views

Published on

Socket.IO for Haskell Folks
--by banacorn
--on Functional Thursday Meetup 8

Published in: Education, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,131
On SlideShare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

[FT-8][banacorn] Socket.IO for Haskell Folks

  1. 1. Socket.IO for Haskell Folks
  2. 2. Real-time Applications
  3. 3. Regular HTTP
  4. 4. Polling
  5. 5. Long-Polling
  6. 6. EventSource
  7. 7. WebSocket
  8. 8. WebSocket
  9. 9. “TCP for the web”
  10. 10. PROS Bi-directional + Full-duplex ! Lower overhead ! Port 80
  11. 11. CONS Not widely supported ! Still a draft*
  12. 12. Socket.IO
  13. 13. asdf
  14. 14. “The cross-browser cross-device WebSocket”
  15. 15. Browser Support IE 5.5+ Safari 2+ Google Chrome 4+ Firefox 3+ Opera 10.61+
  16. 16. Transport Support WebSocket Flash Socket AJAX long polling AJAX multipart Forever iframe JSONP Polling
  17. 17. socket.emit(‘news’, ‘hey!’); ! ! ! Server
  18. 18. socket.on(‘news’, function (data) { console.log(data); // hey! }); ! Client
  19. 19. socket.emit(‘news’, ‘hey!’); ! socket.on(‘ping’, function () { socket.emit(‘pong’); }); Server
  20. 20. socket.on(‘news’, function (data) { console.log(data); // hey! }); ! socket.emit(‘ping’); Client
  21. 21. Originated from Node.js
  22. 22. Now also available in many other languages Erlang Java Lua Python Perl Go C++ C Objective-C Haxe Ruby PHP
  23. 23. Except for Haskell
  24. 24. socketio-0.1.0
  25. 25. socket.emit(‘news’, ‘hey!’); ! socket.on(‘ping’, function () { socket.emit(‘pong’); });
  26. 26. emit “news” [“hey!”] ! on “ping” $ emit “pong” []
  27. 27. Transport Support WebSocket (80%) Flash Socket AJAX long polling AJAX multipart Forever iframe JSONP Polling
  28. 28. Difficulties
  29. 29. Transport Support ಠ~ಠ
  30. 30. Transport Support WebSocket Flash Socket AJAX long polling AJAX multipart Forever iframe JSONP Polling
  31. 31. Transport Support WebSocket Flash Socket AJAX long polling AJAX multipart Forever iframe JSONP Polling
  32. 32. “Premature optimization is the root of all evil”
  33. 33. Monad Transformers ಠ~ಠ
  34. 34. ! KEEP CALM AND JUST USE IT
  35. 35. Iteratee I/O ಠ~ಠ
  36. 36. String/Text/ByteString ಠ~ಠ
  37. 37. {-# LANGUAGE OverloadedStrings #-}
  38. 38. Open Source Community ಠ~ಠ
  39. 39. Originated from Node.js
  40. 40. Cabal Hell ಠ~ಠ
  41. 41. > cabal uninstall cabal: unrecognised command: uninstall (try --help)
  42. 42. cabal-dev?
  43. 43. LIVE DEMO
  44. 44. http://banacorn.org:3000
  45. 45. TODO
  46. 46. cabal-dev?
  47. 47. banacorn/socket.io-haskell ! ! ! ALL CONTRIBUTIONS ARE WELCOME!
  48. 48. THANKS! Questions?

×