Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Clone this wiki locally
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 ()
Examples for 1.2.1
This list will be extended in the future.
Dump Headers Sent by a WebSocket Client
s <- ( @<) $! read "3000" -- listen on port 3000 c <- (<@ ) s -- accept a client forever $! recv c chunk >>= B.putStr -- dump client messages
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.