Skip to content

Examples to convert a gRPC tonic stream to HTTP stream (SSE)

License

Notifications You must be signed in to change notification settings

lapsus-ord/grpc_to_http_stream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gRPC to HTTP streaming examples

Examples to convert gRPC tonic stream to HTTP stream (SSE).

How to run

To no build when running, you can build the project first:

cargo build

gRPC tonic server

cargo run --bin grpc_server

Will start the gRPC server on localhost:50051 by default.
This can be changed with env variables APP_HOST and APP_PORT.

Axum HTTP server

GRPC_URI="localhost:50051" cargo run --bin axum_server

Will start the gRPC server on http://localhost:3000/ by default.
This can be changed with env variables APP_HOST and APP_PORT.
And you can change the gRPC server URI with the env variable GRPC_URI.

You can then test with curl:

curl http://localhost:3000/

Notes

Note

I didn't find solutions to handle errors when dealing with stream on the HTTP SSE side... If anyone has a solution for this, feel free to let me know.

About

Examples to convert a gRPC tonic stream to HTTP stream (SSE)

Topics

Resources

License

Stars

Watchers

Forks

Languages