ghci-websockets

A websocket server that survives GHCi reloads - use your browser to visualise results from the REPL.


Keywords
language, library, Propose Tags , Ghci.Server, Ghci.Server.Config, Ghci.Server.Http.Internal, Ghci.Server.Http.Stage0, Ghci.Server.Websockets.Internal, Ghci.Server.Websockets.Message
License
BSD-3-Clause
Install
cabal install ghci-websockets

Documentation

ghci-websockets

With ghci-websockets you can send data from GHCi straight to the browser, using a websocket connection that survives GHCi reloads.

ghci-websockets.gif

Contents

The Ghci.Websockets module implements the actual websocket server, broadcasting JSON objects to all clients. Ghci.Websockets.Simple adds a custom message type for text, HTML, and plots on top of that.

Quickstart

  • Add ghci-websockets to the build-depends field of your .cabal file
  • Run cabal new-repl
  • Run Ghci.Websockets.Simple.initialiseDef
  • Open html/index.html in a browser
  • In GHCi, run Ghci.Websockets.Simple.broadcastText "hello" (see also broadcastHtml and broadcastPlot from the same module). You may need :set -XOverloadedStrings.

Warning

This packages uses the foreign-store package internally, which is highly unstable. I wouldn't use ghci-websockets for anything other than GHCi.

License

BSD-3-Clause, see LICENSE

Contributions

Bug reports, pull requests etc. are welcome!