github.com/volts-dev/volts@v0.0.0-20240120094013-5e9c65924106/demo/rpc/hello_world/client/main.go (about)

     1  package main
     2  
     3  import (
     4  	"github.com/volts-dev/volts/client"
     5  	"github.com/volts-dev/volts/logger"
     6  )
     7  
     8  func main() {
     9  	service := "Arith.Mul"
    10  	endpoint := "Test.Endpoint"
    11  	address := "127.0.0.1:35999"
    12  	cli, err := client.NewHttpClient()
    13  	req, _ := cli.NewRequest(service, endpoint, nil)
    14  
    15  	// test calling remote address
    16  	if _, err = cli.Call(req, client.WithAddress(address)); err != nil {
    17  		logger.Err("call with address error:", err)
    18  	}
    19  }