websockets-rpc alternatives and similar packages
Based on the "Unclassified" category.
Alternatively, view websockets-rpc alternatives based on common mentions on social networks and blogs.
-
gotta-go-fast
A command line utility for practicing typing and measuring your WPM and accuracy. -
heroku-persistent
Parse DATABASE_URL into configuration types for Persistent -
bit-stream
Lazy infinite compact streams with cache-friendly O(1) indexing and applications for memoization -
ascii-art-to-unicode
Small program to convert ASCII box art to Unicode box drawings. -
hackertyper
"Hack" like a programmer in movies and games! Inspired by hackertyper.net -
rollbar-cli
A group of libraries written in Haskell to communicate with Rollbar API. -
base-unicode-symbols
Unicode alternatives for common functions and operators -
aeson-serialize
Functions for serializing a type that is an instance of ToJSON -
dependent-sum-template
Template Haskell code to generate instances of classes in dependent-sum package -
argon2
Haskell bindings to libargon2 - the reference implementation of the Argon2 password-hashing function -
webkit-javascriptcore
webkit javascriptcore library FFI -
servant-streaming
Support for servant requests and responses via the 'streaming' library -
rerebase
Reexports from "base" with a bunch of other standard libraries -
containers-unicode-symbols
Unicode alternatives for common functions and operators -
semver-range
Implementation of semver and NPM-style semantic version ranges in Haskell -
postgresql-simple-sop
Generic functions for postgresql-simple -
hasql-dynamic-statements
Dynamic statements for Hasql -
bitcoind-regtest
A cilent for the bitcoind JSON-RPC interface -
ptr-poker
Pointer poking action construction and composition toolkit
WorkOS - The modern identity platform for B2B SaaS
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of websockets-rpc or a related project?
README
websockets-rpc
A simple message-based streaming RPC mechanism built using WebSockets
Usage
The idea is pretty simple:
- A client initiates the RPC call to a server with a
Subscription
- the client may send additional data at any time with
Supply
, who can also cancel the RPC call - the server may respond incrementally with
Reply
- the server finishes the RPC call with a
Complete
client server
------------------------subscribe--------------------------->
- - - - - - - - - - - - -supply - - - - - - - - - - - - - - >
< - - - - - - - - - - - -reply- - - - - - - - - - - - - - - -
<-----------------------complete-----------------------------
if the supply
and reply
parts were ommitted, it would be identical to a traditional RPC mechanism.
Example
import Network.WebSockets.RPC
import Data.Aeson
-- subscriptions from client to server
data MySubDSL = Foo
deriving (FromJSON, ToJSON) -- you should figure this part out :)
-- supplies from client to server
data MySupDSL = Bar
deriving (FromJSON, ToJSON)
-- replies from server to client
data MyRepDSL = Baz
deriving (FromJSON, ToJSON)
-- onCompletes from server to client
data MyComDSL = Qux
deriving (FromJSON, ToJSON)
Server:
{-# LANGUAGE NamedFieldPuns, ScopedTypeVariables #-}
myServer :: (MonadIO m, MonadThrow m) => ServerAppT (WebSocketServerRPCT MySubDSL MySupDSL m)
myServer = rpcServer $ \RPCServerParams{reply,complete} eSubSup -> case eSubSup of
Left Foo -> do
forM_ [1..5] $ \_ -> do
liftIO $ threadDelay 1000000
reply Baz
complete Qux
Right Bar -> reply Baz
Client:
{-# LANGUAGE NamedFieldPuns #-}
myClient :: (MonadIO m, MonadThrow m) => ClientAppT (WebSocketClientRPCT MyRepDSL MyComDSL m) ()
myClient = rpcClient $ \dispatch ->
-- only going to make one RPC call for this example
dispatch RPCClient
{ subscription = Foo
, onReply = \RPCClientParams{supply,cancel} Baz -> do
liftIO $ threadDelay 1000000
supply Bar
(q :: Bool) <- liftIO getRandom
if q then cancel else pure ()
, onComplete = \Qux -> liftIO $ putStrLn "finished"
}
the
threadDelay
calls are just to exemplify the asynchronisity of the system, nothing to do with avoiding race conditions >.>
To turn the ServerAppT
and ClientAppT
into natural WebSockets
types, use the morphisms from Wai-Transformers.
Contributing
this is my swamp