thrift Originally the RPC communication framework used by Facebook, it was later contributed to the Apache foundation, which came out earlier, almost supported all the back-end languages, and was very widely used as an unknown network framework.
Like grpc, you need to define communication protocols first and then implement your business logic.
The following methods are introduced.
Note: the repository time is 2017.7 at that time, so context was not supported at that time.
As for the usage of thrift, you can use thrift -help to view help.
The following command will generate the gen-go folder, which translates the above protocol into golang code.
Among them, echo.go is the type and method definition generated, and echo-remote is the client sample code.
The following is a simple example of its use.
message from client: You are welcome.
Note: the protocol used by the server and the client must be the same, for example, the transport factory is buffer transport factroy, and protocol factory is compaCT protcol.