Stop gRPC Method
Paramètres
Cette méthode n'accepte aucun paramètre
Retours
erreur
chaîne de caractères
Chargement en cours...
Demande
1paquet principal23import (4« contexte »5« crypto/tls »6« fmt »78« github.sdk »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 jeton = "VOTRE_TOKEN"20var endpoint = "VOTRE_POINT_DE_FIN :50051"212223type auth struct {24jeton chaîne de caractères25}2627func (a *auth) GetRequestMetadata(ctx contexte.Context, uri ...chaîne) (carte[chaîne]chaîne, erreur) {28retour carte[chaîne]chaîne{29« x-token »: un.jeton,30}, nil31}3233func (a *auth) RequireTransportSecurity() bool {34retour false35}3637func main() {38opts := []grpc.DialOption{39grpc.WithTransportCredentials(informations d'authentification.NewTLS(&tls.Config{})),40grpc.Avec les identifiants RPCC(&auth{token}),41}42conn := client.NewGrpcClient(endpoint)43if err := conn.Start(opts...); err != nil {44panique(erreur)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 {58panique(erreur)59}60fmt.Println("Client restarted successfully")6162conn.Stop()63fmt.Println("Client stopped again")6465}
1paquet principal23import (4« contexte »5« crypto/tls »6« fmt »78« github.sdk »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 jeton = "VOTRE_TOKEN"20var endpoint = "VOTRE_POINT_DE_FIN :50051"212223type auth struct {24jeton chaîne de caractères25}2627func (a *auth) GetRequestMetadata(ctx contexte.Context, uri ...chaîne) (carte[chaîne]chaîne, erreur) {28retour carte[chaîne]chaîne{29« x-token »: un.jeton,30}, nil31}3233func (a *auth) RequireTransportSecurity() bool {34retour false35}3637func main() {38opts := []grpc.DialOption{39grpc.WithTransportCredentials(informations d'authentification.NewTLS(&tls.Config{})),40grpc.Avec les identifiants RPCC(&auth{token}),41}42conn := client.NewGrpcClient(endpoint)43if err := conn.Start(opts...); err != nil {44panique(erreur)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 {58panique(erreur)59}60fmt.Println("Client restarted successfully")6162conn.Stop()63fmt.Println("Client stopped again")6465}
Vous n'avez pas encore de compte ?
Créez votreendpoint Quicknode endpoint quelques secondes et commencez à développer
Commencez gratuitement