2
2
3
3
# Connect-RPC ↔ ScalaPB GRPC Bridge
4
4
5
- This library provides a bridge between [ Connect-RPC ] ( https://connectrpc.com/docs/protocol ) protocol and
5
+ This library provides a bridge between [ Connect] ( https://connectrpc.com/docs/protocol ) protocol and
6
6
[ ScalaPB] ( https://scalapb.github.io ) GRPC compiler for Scala.
7
7
It is inspired and takes ideas from [ grpc-json-bridge] ( https://github.com/avast/grpc-json-bridge ) library, which doesn't
8
8
seem to be supported anymore + the library doesn't follow a Connect-RPC standard (while being very close to it),
@@ -26,14 +26,14 @@ So the most common approach is to expose REST APIs, which will be translated to
26
26
There are two main protocols for this:
27
27
28
28
* [ GRPC-WEB] ( https://github.com/grpc/grpc-web )
29
- * [ Connect-RPC ] ( https://connectrpc.com/docs/introduction )
29
+ * [ Connect] ( https://connectrpc.com/docs/introduction )
30
30
31
- They are similar, but GRPC-WEB target is to be as close to GRPC as possible, while Connect-RPC is more
31
+ They are similar, but GRPC-WEB target is to be as close to GRPC as possible, while Connect is more
32
32
web-friendly: it has better client libraries, better web semantics:
33
33
content-type is ` application/json ` instead of ` application/grpc-web+json ` , error codes are just normal http codes
34
34
instead of being sent in headers, errors are output in the body of the response JSON-encoded, it supports GET-requests,
35
35
etc (you can also read
36
- this [ blog post describing why ConnectRPC is better] ( https://buf.build/blog/connect-a-better-grpc ) ).
36
+ this [ blog post describing why Connect is better] ( https://buf.build/blog/connect-a-better-grpc ) ).
37
37
38
38
Both protocols support encoding data in Protobuf and JSON.
39
39
JSON is more web-friendly, but it requires having some component in the middle, providing JSON → Protobuf
@@ -51,7 +51,7 @@ To support JSON, Envoy needs to be configured with Protobuf descriptors, which i
51
51
* That's where this library comes in* :
52
52
53
53
It allows exposing GRPC services, built with [ ScalaPB] ( https://scalapb.github.io ) , to the clients
54
- using Connect-RPC protocol (with JSON messages), without Envoy or any other proxy, so a web service can expose
54
+ using Connect protocol (with JSON messages), without Envoy or any other proxy, so a web service can expose
55
55
both GRPC and REST APIs at the same time on two ports.
56
56
57
57
This simplifies overall setup: simpler CI, fewer network components, faster execution speed.
@@ -80,7 +80,7 @@ libraryDependencies ++= Seq(
80
80
)
81
81
` ` `
82
82
83
- After installing the library, you can expose your GRPC service to the clients using Connect-RPC protocol (suppose you
83
+ After installing the library, you can expose your GRPC service to the clients using Connect protocol (suppose you
84
84
already have a GRPC services generated with ScalaPB) :
85
85
86
86
` ` ` scala
@@ -110,12 +110,12 @@ val httpServer: Resource[IO, org.http4s.server.Server] = {
110
110
httpServer.use(_ => IO.never).unsafeRunSync()
111
111
` ` `
112
112
113
- # ## Tip: GRPC Opentelemetry integration
113
+ # ## Tip: GRPC OpenTelemetry integration
114
114
115
- Since the library creates a separate "fake" grpc server, traffic going through it won't be captured by the
116
- instrumentation of the main grpc server.
115
+ Since the library creates a separate "fake" GRPC server, traffic going through it won't be captured by the
116
+ instrumentation of the main GRPC server.
117
117
118
- Here is how you can integrate the Opentelemetry with the Connect-RPC server :
118
+ Here is how you can integrate OpenTelemetry with the Connect-RPC server :
119
119
120
120
` ` ` scala
121
121
val grpcServices: Seq[io.grpc.ServiceDefinition] = ??? // Your GRPC service(s)
@@ -154,7 +154,7 @@ Current status: 6/79 tests pass
154
154
155
155
Known issues :
156
156
157
- * fs2-grpc server implementation doesn't support setting response headers
157
+ * ` fs2-grpc` server implementation doesn't support setting response headers (which is required by the tests)
158
158
* `google.protobuf.Any` serialization doesn't follow Connect-RPC spec
159
159
160
160
# # Future improvements
0 commit comments