[FT-8][banacorn] Socket.IO for Haskell Folks
-
Upload
functional-thursday -
Category
Education
-
view
638 -
download
1
description
Transcript of [FT-8][banacorn] Socket.IO for Haskell Folks
Socket.IO for Haskell Folks
Real-time Applications
Regular HTTP
Polling
Long-Polling
EventSource
WebSocket
WebSocket
“TCP for the web”
PROS
Bi-directional + Full-duplex !
Lower overhead !
Port 80
CONSNot widely supported !
Still a draft*
Socket.IO
asdf
“The cross-browser cross-device WebSocket”
Browser Support
IE 5.5+ Safari 2+ Google Chrome 4+ Firefox 3+ Opera 10.61+
Transport Support
WebSocket Flash Socket AJAX long polling AJAX multipart Forever iframe JSONP Polling
socket.emit(‘news’, ‘hey!’); !
!
!
Server
socket.on(‘news’, function (data) { console.log(data); // hey! }); !
Client
socket.emit(‘news’, ‘hey!’); !
socket.on(‘ping’, function () { socket.emit(‘pong’); });
Server
socket.on(‘news’, function (data) { console.log(data); // hey! }); !
socket.emit(‘ping’);
Client
Originated from Node.js
Now also available in many other languages
ErlangJava
Lua
Python
Perl
Go
C++
C
Objective-C
Haxe
Ruby
PHP
Except for Haskell
socketio-0.1.0
socket.emit(‘news’, ‘hey!’); !
socket.on(‘ping’, function () { socket.emit(‘pong’); });
emit “news” [“hey!”] !
on “ping” $ emit “pong” []
Transport Support
WebSocket (80%) Flash Socket AJAX long polling AJAX multipart Forever iframe JSONP Polling
Difficulties
Transport Support
ಠ~ಠ
Transport Support
WebSocket Flash Socket AJAX long polling AJAX multipart Forever iframe JSONP Polling
Transport Support
WebSocket Flash Socket AJAX long polling AJAX multipart Forever iframe JSONP Polling
“Premature optimization is the root of all evil”
Monad Transformers
ಠ~ಠ
!
KEEP
CALM AND
JUST
USE IT
Iteratee I/O
ಠ~ಠ
String/Text/ByteString
ಠ~ಠ
{-# LANGUAGE OverloadedStrings #-}
Open Source Community
ಠ~ಠ
Originated from Node.js
Cabal Hell
ಠ~ಠ
> cabal uninstall cabal: unrecognised command: uninstall (try --help)
cabal-dev?
LIVE DEMO
http://banacorn.org:3000
TODO
cabal-dev?
banacorn/socket.io-haskell !
!
!
ALL CONTRIBUTIONS ARE WELCOME!
THANKS! Questions?