Stop gRPC Method
Parâmetros
Este método não aceita quaisquer parâmetros
Devoluções
erro
cadeia de caracteres
Carregando...
Pedido
1pacote principal23importar (4"contexto"5"crypto/tls"6"fmt"78"github.com/fbsobreira/gotron-sdk/pkg/client"9"google.golang.grpc"10"google.golang.grpc"11)121314// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token15// For eg: QN Endpoint: https://docs-demo.tron-mainnet.quiknode.pro/abcde12345678916// endpoint will be: docs-demo.tron-mainnet.quiknode.pro:50051 {50051 is the port number for Tron gRPC}17// token will be : abcde1234567891819var token = "O_SEU_TOKEN"20var endpoint = "YOUR_ENDPOINT:50051"212223tipo auth estrutura {24token cadeia de caracteres25}2627func (a *auth) GetRequestMetadata(ctx contexto.Context, uri ...string) (mapa[string]cadeia de caracteres, erro) {28retornar mapa[string]string{29«x-token»: um.token,30}, nil31}3233func (a *auth) RequireTransportSecurity() bool {34retornar false35}3637func main() {38opts := []grpc.DialOption{39grpc.WithTransportCredentials(credenciais.NewTLS(&tls.Config{})),40grpc.WithPerRPCCredentials(&auth{token}),41}42conn := client.NewGrpcClient(endpoint)43if err := conn.Start(opts...); err != nil {44panic(err)45}4647fmt.Println("Client successfully started")4849fmt.Println("Performing operations...")5051fmt.Println("Operations completed, stopping client...")52conn.Stop()5354fmt.Println("Client stopped successfully")5556fmt.Println("Restarting client...")57if err := conn.Start(opts...); err != nil {58panic(err)59}60fmt.Println("Client restarted successfully")6162conn.Stop()63fmt.Println("Client stopped again")6465}
1pacote principal23importar (4"contexto"5"crypto/tls"6"fmt"78"github.com/fbsobreira/gotron-sdk/pkg/client"9"google.golang.grpc"10"google.golang.grpc"11)121314// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token15// For eg: QN Endpoint: https://docs-demo.tron-mainnet.quiknode.pro/abcde12345678916// endpoint will be: docs-demo.tron-mainnet.quiknode.pro:50051 {50051 is the port number for Tron gRPC}17// token will be : abcde1234567891819var token = "O_SEU_TOKEN"20var endpoint = "YOUR_ENDPOINT:50051"212223tipo auth estrutura {24token cadeia de caracteres25}2627func (a *auth) GetRequestMetadata(ctx contexto.Context, uri ...string) (mapa[string]cadeia de caracteres, erro) {28retornar mapa[string]string{29«x-token»: um.token,30}, nil31}3233func (a *auth) RequireTransportSecurity() bool {34retornar false35}3637func main() {38opts := []grpc.DialOption{39grpc.WithTransportCredentials(credenciais.NewTLS(&tls.Config{})),40grpc.WithPerRPCCredentials(&auth{token}),41}42conn := client.NewGrpcClient(endpoint)43if err := conn.Start(opts...); err != nil {44panic(err)45}4647fmt.Println("Client successfully started")4849fmt.Println("Performing operations...")5051fmt.Println("Operations completed, stopping client...")52conn.Stop()5354fmt.Println("Client stopped successfully")5556fmt.Println("Restarting client...")57if err := conn.Start(opts...); err != nil {58panic(err)59}60fmt.Println("Client restarted successfully")6162conn.Stop()63fmt.Println("Client stopped again")6465}
Ainda não tem uma conta?
Crieendpoint seuendpoint Quicknode endpoint segundos e comece a desenvolver
Comece gratuitamente