ping gRPC Method - Solana gRPC
Solana gRPC is included with Scale plans and up. Learn more on our pricing page.
पैरामीटर
count
पूर्णांक
लोड हो रहा है...
रिटर्न
count
पूर्णांक
लोड हो रहा है...
अनुरोध
1पैकेज मुख्य23आयात (4"प्रसंग"5"क्रिप्टो/टीएलएस"6"एफएमटी"7"लकड़ी का लट्ठा"8"समय"910pb "yellowstone/proto"111213"google.golang.org/ grpc "14"google.golang.org/ grpc /साख"15"google.golang.org/grpc/encoding/gzip"16"google.golang.org/grpc/keepalive"17)1819// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token20// For eg: QN Endpoint: https://docs-demo.solana-mainnet.quiknode.pro/abcde12345678921// endpoint will be: docs-demo.solana-mainnet.quiknode.pro:443 {443 is the port number for gRPC}22// token will be : abcde1234567892324var (25endpoint = "YOUR_QN_ENDPOINT:443"26token = "YOUR_TOKEN_NUMBER"27)2829var kacp = keepalive.ClientParameters{30Time: 10 * time.Second,31Timeout: time.Second,32PermitWithoutStream: true,33}3435type tokenAuth struct {36टोकन स्ट्रिंग37}3839func (t tokenAuth) GetRequestMetadata(ctx context.Context, in ...string) (map[string]string, error) {40वापस करना मानचित्र [ स्ट्रिंग ] स्ट्रिंग {41"x-token": t.token,42} , शून्य43}4445func (tokenAuth) RequireTransportSecurity() bool {46return true47}4849समारोह मुख्य ( ) {50opts := []grpc.DialOption{51grpc ( credentials.NewTLS ( & tls.Config { } ) )52grpc.WithKeepaliveParams(kacp),53grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(1024*1024*1024), grpc.UseCompressor(gzip.Name)),54grpc.WithPerRPCCredentials(tokenAuth{token: token}),55}5657conn, err := grpc.NewClient(endpoint, opts...)58यदि त्रुटि != शून्य {59log.Fatalf("Failed to connect: %v", err)60}61कनेक्शन स्थगित करें । बंद करें ( )6263client := pb.NewGeyserClient(conn)6465ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)66defer cancel()6768pingResponse, err := client.Ping(ctx, &pb.PingRequest{Count: 1})69यदि त्रुटि != शून्य {70log.Fatalf("Failed to get Ping: %v", err)71}72fmt.Printf(" Ping Response: %d\n", pingResponse.GetCount())7374}75
1पैकेज मुख्य23आयात (4"प्रसंग"5"क्रिप्टो/टीएलएस"6"एफएमटी"7"लकड़ी का लट्ठा"8"समय"910pb "yellowstone/proto"111213"google.golang.org/ grpc "14"google.golang.org/ grpc /साख"15"google.golang.org/grpc/encoding/gzip"16"google.golang.org/grpc/keepalive"17)1819// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token20// For eg: QN Endpoint: https://docs-demo.solana-mainnet.quiknode.pro/abcde12345678921// endpoint will be: docs-demo.solana-mainnet.quiknode.pro:443 {443 is the port number for gRPC}22// token will be : abcde1234567892324var (25endpoint = "YOUR_QN_ENDPOINT:443"26token = "YOUR_TOKEN_NUMBER"27)2829var kacp = keepalive.ClientParameters{30Time: 10 * time.Second,31Timeout: time.Second,32PermitWithoutStream: true,33}3435type tokenAuth struct {36टोकन स्ट्रिंग37}3839func (t tokenAuth) GetRequestMetadata(ctx context.Context, in ...string) (map[string]string, error) {40वापस करना मानचित्र [ स्ट्रिंग ] स्ट्रिंग {41"x-token": t.token,42} , शून्य43}4445func (tokenAuth) RequireTransportSecurity() bool {46return true47}4849समारोह मुख्य ( ) {50opts := []grpc.DialOption{51grpc ( credentials.NewTLS ( & tls.Config { } ) )52grpc.WithKeepaliveParams(kacp),53grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(1024*1024*1024), grpc.UseCompressor(gzip.Name)),54grpc.WithPerRPCCredentials(tokenAuth{token: token}),55}5657conn, err := grpc.NewClient(endpoint, opts...)58यदि त्रुटि != शून्य {59log.Fatalf("Failed to connect: %v", err)60}61कनेक्शन स्थगित करें । बंद करें ( )6263client := pb.NewGeyserClient(conn)6465ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)66defer cancel()6768pingResponse, err := client.Ping(ctx, &pb.PingRequest{Count: 1})69यदि त्रुटि != शून्य {70log.Fatalf("Failed to get Ping: %v", err)71}72fmt.Printf(" Ping Response: %d\n", pingResponse.GetCount())7374}75
1import Client, {2CommitmentLevel,3SubscribeRequest,4SubscribeRequestFilterAccountsFilter,5} from "@triton-one/yellowstone-grpc";67// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token8// For eg: QN Endpoint: https://docs-demo.solana-mainnet.quiknode.pro/abcde1234567899// endpoint will be: https://docs-demo.solana-mainnet.quiknode.pro:443 {443 is the port number for gRPC}10// token will be : abcde1234567891112const ENDPOINT = "https://YOUR_QN_ENDPOINT:443";13const TOKEN = "YOUR_TOKEN_NUMBER";1415अतुल्यकालिक समारोह मुख्य ( ) {16const client = new Client(ENDPOINT, TOKEN, {17grpcDefaultCompressionAlgorithm: 0, // 0 = gzip, 1 = zstd18});19await client.connect();20const response = await client.ping(1);21console.log(`Response: ${response.count}`);22}2324main()25.catch((err) => {26console.error(err);27process.exit(1);28} )29
1import Client, {2CommitmentLevel,3SubscribeRequest,4SubscribeRequestFilterAccountsFilter,5} from "@triton-one/yellowstone-grpc";67// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token8// For eg: QN Endpoint: https://docs-demo.solana-mainnet.quiknode.pro/abcde1234567899// endpoint will be: https://docs-demo.solana-mainnet.quiknode.pro:443 {443 is the port number for gRPC}10// token will be : abcde1234567891112const ENDPOINT = "https://YOUR_QN_ENDPOINT:443";13const TOKEN = "YOUR_TOKEN_NUMBER";1415अतुल्यकालिक समारोह मुख्य ( ) {16const client = new Client(ENDPOINT, TOKEN, {17grpcDefaultCompressionAlgorithm: 0, // 0 = gzip, 1 = zstd18});19await client.connect();20const response = await client.ping(1);21console.log(`Response: ${response.count}`);22}2324main()25.catch((err) => {26console.error(err);27process.exit(1);28} )29
अब तक कोई खाता नहीं है?
अपना बनाएँ Quicknode endpoint कुछ ही सेकंड में निर्माण शुरू करें
मुफ़्त में शुरुआत करें