Skip to content

AllanOricil/frpc-echo-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simplest fRPC Example

Contains the source code for the example explained in the fRPC Quick Start Guide. This one actually works...

Requirements

  • go >= 1.18
  • protoc >= 3
brew install go
brew install protoc

Go setup (optional if you have already done it)

Create a directory to serve as the workspace for your go projects

mkdir $HOME/go

Setup GOPATH, GOBIN and PATH env variables as follows

export GOPATH=$HOME/go
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN

Ensure these variables are also present on every new shell session running the following code to change your shell rc file:

echo "export GOPATH=$HOME/go" >> $HOME/.zshrc
echo "export GOBIN=$GOPATH/bin" >> $HOME/.zshrc
echo "export PATH=$PATH:$GOBIN" >> $HOME/.zshrc

1 - Install protoc-gen-go-frpc

Install protoc-gen-go-frpc plugin running the following command:

go install github.com/loopholelabs/frpc-go/protoc-gen-go-frpc@latest

Verify the package was installed correctly running the following command:

which protoc-gen-go-frpc

From the root of this project, run the following comand to generate the server and client code using the specs in echo.proto

protoc --go-frpc_out=. echo.proto

Verify that echo/echo.frpc.go was created in the root of the project. Open it and change github.com/loopholelabs/polyglot-go to github.com/loopholelabs/polyglot in the imports section, and save.

2 - Install project dependencies

go mod download

3 - Run Server

Open a new terminal and start the server running the following command

go run server/main.go

Server

4 - Run the Client

Open a new terminal and start the client running the following command

go run client/main.go

Client

About

fRPC example from frpc.io which actually works...

Topics

Resources

Stars

Watchers

Forks

Languages