MCPcopy Create free account
hub / github.com/Effect-TS/effect / makeProtocolHttpUnbatched

Function makeProtocolHttpUnbatched

packages/effect/src/rpc/RpcClient.ts:989–1008  ·  view source on GitHub ↗
(client: HttpClient.HttpClient)

Source from the content-addressed store, hash-verified

987> => options?.batch ? makeProtocolHttpBatched(client, options.batch) : makeProtocolHttpUnbatched(client)
988
989const makeProtocolHttpUnbatched = (client: HttpClient.HttpClient) =>
990 Protocol.make(Effect.fnUntraced(function*(writeResponse) {
991 const serialization = yield* RpcSerialization.RpcSerialization
992 const exchange = makeHttpExchange(client, serialization, writeResponse)
993 return {
994 send: (clientId, request) => {
995 if (request._tag !== "Request") return Effect.void
996 return Effect.flatMap(
997 exchange.send(clientId, [request]),
998 (pending) =>
999 exchange.isNotification(request)
1000 ? exchange.acknowledge(clientId, request)
1001 : exchange.requestExit(request, pending)
1002 )
1003 },
1004 supportsAck: false,
1005 supportsTransferables: false,
1006 codecFor: serialization.codecFor
1007 }
1008 }))
1009
1010const withBatchSpan = <A, E, R>(effect: Effect.Effect<A, E, R>, requests: ReadonlyArray<RequestEncoded>) => {
1011 const links: Array<Tracer.SpanLink> = []

Callers 1

makeProtocolHttpFunction · 0.85

Calls 4

makeHttpExchangeFunction · 0.85
acknowledgeMethod · 0.80
makeMethod · 0.65
sendMethod · 0.65

Tested by

no test coverage detected