Make a non-streaming RPC
Example usage:
type GetFeature = Protobuf RouteGuide "getFeature"
getFeature :: Connection -> Point -> IO ()
getFeature conn point = do
features <- nonStreaming conn (rpc @GetFeature) point
print features:: a typeCtrl KGHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05
Modulegrapesy-1.1.1Haskell2010
Execute handlers for specific communication patterns
See also Network.GRPC.Common.StreamType as well as Network.GRPC.Client.StreamType.CanCallRPC.
Make a non-streaming RPC
Example usage:
type GetFeature = Protobuf RouteGuide "getFeature"
getFeature :: Connection -> Point -> IO ()
getFeature conn point = do
features <- nonStreaming conn (rpc @GetFeature) point
print featuresGeneralization of clientStreaming_ with an additional result.
Make a client-side streaming RPC
Example usage:
type RecordRoute = Protobuf RouteGuide "recordRoute"
recordRoute :: Connection -> [Point] -> IO ()
recordRoute conn points = do
summary <- clientStreaming_ conn (rpc @RecordRoute) $ \send ->
forM_ points send
print summaryMake a server-side streaming RPC
Example usage:
type ListFeatures = Protobuf RouteGuide "listFeatures"
listFeatures :: Connection -> Rectangle -> IO ()
listFeatures conn rect =
serverStreaming conn (rpc @ListFeatures) rect $ \recv ->
whileJust_ recv printMake a bidirectional RPC
Example usage:
type RouteChat = Protobuf RouteGuide "routeChat"
routeChat :: Connection -> [RouteNote] -> IO ()
routeChat conn notes =
biDiStreaming conn (rpc @RouteChat) $ \send recv ->
forM_ notes $ \note -> do
send note
print =<< recv