woot: Real time group editor without operational transform.

[ data, library, mit ] [ Propose Tags ]

Without operation transform - WOOT.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.0.0.0, 0.0.0.1, 0.0.0.2, 0.0.0.3, 0.0.0.4, 0.0.0.5, 0.0.0.6
Dependencies base (<=5), vector [details]
License MIT
Author Tyler Olson
Maintainer tydotg@gmail.com
Category Data
Home page https://github.com/TGOlson/woot-haskell
Bug tracker https://github.com/TGOlson/woot-haskell/issues
Source repo head: git clone https://github.com/TGOlson/woot-haskell
Uploaded by tgolson at 2016-08-05T03:20:48Z
Distributions NixOS:0.0.0.6
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 4147 total (19 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2016-08-05 [all 1 reports]

Readme for woot-0.0.0.6

[back to package description]

woot

Core library for creating real time collaborative documents without Operational transformation (WOOT). This package provides the core logic and data types for building a server capable and handling real time editing with WOOT.

Real time group editors without Operational transformation

Install

$ stack install woot

Test

stack test

Notes:

Example:

Here is a small example of how one would use this library to create a server that keeps an internal WootClient and updates the client upon request.

Each time the server receives a POST request with an Operation in the JSON body, it will apply that operation to a cached WootClient instance, and then update the cache. This server could easily receive many updates from many other clients, and reliably process the operations.

import Control.Concurrent.STM
import Data.Aeson
import Data.IORef
import Data.Woot
import Network.HTTP.Types.Status
import Network.Wai
import Network.Wai.Handler.Warp


-- ...
-- FromJSON instances for Operation and other necessary types


makeEmptyClient :: IO (IORef WootClient)
makeEmptyClient = newIORef $ makeWootClientEmpty 1


wootApp :: IORef WootClient -> Application
wootApp clientRef req respond = do
    body <- requestBody req

    let mOperation = decodeStrict body

    case mOperation of
        Nothing -> return ()
        Just operation -> do
            client <- readIORef clientRef
            let newClient = sendOperation client operation
            _ <- writeIORef clientRef newClient
            putStrLn $ "Updated Client: " ++ show (wootClientString newClient)

    respond $ responseLBS status200 [] "WOOOOT!"


runWootApp :: IO ()
runWootApp = makeEmptyClient >>= run 8000 . wootApp

TODO:

  • ci
  • docs
  • examples