-
Notifications
You must be signed in to change notification settings - Fork 41
PortFusion REPL
cetinsert edited this page Sep 6, 2014
·
1 revision
Changes introduced in version 1.1 made Main.hs completely self-contained.
PortFusion can now be loaded and tested from within GHCi.
cd PortFusion
ghci src/Main.hs
The PortFusion REPL is an incredibly convenient way to start using the internals of PortFusion without much knowledge about Haskell or having to worry about which modules and functions to import from which Haskell library. The examples below are guaranteed to just work !
Note: On Windows you need the following as the first command in a new session.
withSocketsDo $ return ()
This list will be extended in the future.
s <- ( @<) $! read "3000" -- listen on port 3000
c <- (<@ ) s -- accept a client
forever $! recv c chunk >>= B.putStr -- dump client messages
Visit: http://jsfiddle.net/yfDpq/5/
GET / HTTP/1.1
Upgrade: websocket
Connection: Upgrade
Host: [::1]:3000
Origin: http://fiddle.jshell.net
Sec-WebSocket-Key: JMt7VzItsvWI/dvDKyJR6w==
Sec-WebSocket-Version: 13
Sec-WebSocket-Extensions: x-webkit-deflate-frame
Internal APIs are subject to change between every release.
This page always lists up-to-date examples for the latest version.