ping

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2021 License: MIT Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

Functions

func RegisterPingServiceServer

func RegisterPingServiceServer(s *grpc.Server, srv PingServiceServer)

func SendPingMsg

func SendPingMsg(client PingServiceClient) (string, error)

SendPingMsg function used by the client to send a ping message to the server.

Types

type PingService

type PingService struct {
	// UnimplementedPingServiceServer can be embedded to have forward-compatible implementations
	UnimplementedPingServiceServer
}

PingService struct can work as Ping/Pong service between server and client to test the gRPC connection flow.

func (*PingService) SendPongMsg

func (s *PingService) SendPongMsg(ctx context.Context, req *Request) (*Response, error)

SendPongMsg function used by the server to send pong messages to the client.

type PingServiceClient

type PingServiceClient interface {
	SendPongMsg(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
}

PingServiceClient is the client API for PingService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

type PingServiceServer

type PingServiceServer interface {
	SendPongMsg(context.Context, *Request) (*Response, error)
}

PingServiceServer is the server API for PingService service.

type Pong

type Pong struct {
	Index      int32                  `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"`
	Message    string                 `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	ReceivedOn *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=received_on,json=receivedOn,proto3" json:"received_on,omitempty"`
	// contains filtered or unexported fields
}

func (*Pong) Descriptor deprecated

func (*Pong) Descriptor() ([]byte, []int)

Deprecated: Use Pong.ProtoReflect.Descriptor instead.

func (*Pong) GetIndex

func (x *Pong) GetIndex() int32

func (*Pong) GetMessage

func (x *Pong) GetMessage() string

func (*Pong) GetReceivedOn

func (x *Pong) GetReceivedOn() *timestamppb.Timestamp

func (*Pong) ProtoMessage

func (*Pong) ProtoMessage()

func (*Pong) ProtoReflect

func (x *Pong) ProtoReflect() protoreflect.Message

func (*Pong) Reset

func (x *Pong) Reset()

func (*Pong) String

func (x *Pong) String() string

type Request

type Request struct {
	Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

func (*Request) Descriptor deprecated

func (*Request) Descriptor() ([]byte, []int)

Deprecated: Use Request.ProtoReflect.Descriptor instead.

func (*Request) GetMessage

func (x *Request) GetMessage() string

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) ProtoReflect

func (x *Request) ProtoReflect() protoreflect.Message

func (*Request) Reset

func (x *Request) Reset()

func (*Request) String

func (x *Request) String() string

type Response

type Response struct {
	Pong *Pong `protobuf:"bytes,1,opt,name=pong,proto3" json:"pong,omitempty"`
	// contains filtered or unexported fields
}

func (*Response) Descriptor deprecated

func (*Response) Descriptor() ([]byte, []int)

Deprecated: Use Response.ProtoReflect.Descriptor instead.

func (*Response) GetPong

func (x *Response) GetPong() *Pong

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) ProtoReflect

func (x *Response) ProtoReflect() protoreflect.Message

func (*Response) Reset

func (x *Response) Reset()

func (*Response) String

func (x *Response) String() string

type UnimplementedPingServiceServer

type UnimplementedPingServiceServer struct {
}

UnimplementedPingServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedPingServiceServer) SendPongMsg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL