Skip to main content
/
Haskell
/
Group items tagged websockets
Group items tagged
Filter:
All
|
Bookmarks
|
Topics
Simple
Middle
1
More
Fatvat: Web Sockets and Haskell
- 0 views
www.fatvat.co.uk/...web-sockets-and-haskell.html
web
socket
haskell
example
toHack
webdev
shared by
Javier Neira
on 05 Jan 10
-
No Cached
Javier Neira
on 05 Jan 10
import Network import System.IO import Control.Concurrent import Char serverHandshake = "HTTP/1.1 101 Web Socket Protocol Handshake\r\n\ \Upgrade: WebSocket\r\n\ \Connection: Upgrade\r\n\ \WebSocket-Origin:
http://localhost\r\n
\ \WebSocket-Location: ws://localhost:9876/\r\n\ \WebSocket-Protocol: sample\r\n\r\n\0" acceptLoop socket = forever $ do (h,_,_) IO () listenLoop h = do sendFrame h "hello from haskell" threadDelay (3 * 1000000) sendFrame h "it works!" return () sendFrame :: Handle -> String -> IO () sendFrame h s = do hPutChar h (chr 0) hPutStr h s hPutChar h (chr 255)
import Network import System.IO import Control.Concurrent import Char serverHandshake = "HTTP/1.1 101 Web Socket Protocol Handshake\r\n\ \Upgrade: WebSocket\r\n\ \Connection: Upgrade\r\n\ \WebSocket-Origin:
http://localhost\r\n
\ \WebSocket-Location: ws://localhost:9876/\r\n\ \WebSocket-Protocol: sample\r\n\r\n\0" acceptLoop socket = forever $ do (h,_,_) IO () listenLoop h = do sendFrame h "hello from haskell" threadDelay (3 * 1000000) sendFrame h "it works!" return () sendFrame :: Handle -> String -> IO () sendFrame h s = do hPutChar h (chr 0) hPutStr h s hPutChar h (chr 255)
...
Cancel
...
Cancel
Fatvat: Brian's Brain in JavaScript and Haskell
- 0 views
www.fatvat.co.uk/...rain-is-celluar-automaton.html
javascript
haskell
brians
brain
example
websockets
shared by
Javier Neira
on 14 Jan 10
-
No Cached
...
Cancel
1
-
2
of
2
Showing
20
▼
items per page
20
50
100
Related searches
Search
websockets
matching in title, tags, annotations and url of group items »
Search in Google »