remote

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: May 7, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_remote_mqtt_proto protoreflect.FileDescriptor

Functions

func RegisterMQTTServer

func RegisterMQTTServer(s *grpc.Server, srv MQTTServer)

Types

type MQTTClient

type MQTTClient interface {
	// Sends the specified message to the specified topic.
	//
	// returns true if the message has been sent.
	SendMessage(ctx context.Context, in *Message, opts ...grpc.CallOption) (*SendMessageResult, error)
}

MQTTClient is the client API for MQTT service.

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

func NewMQTTClient

func NewMQTTClient(cc grpc.ClientConnInterface) MQTTClient

type MQTTServer

type MQTTServer interface {
	// Sends the specified message to the specified topic.
	//
	// returns true if the message has been sent.
	SendMessage(context.Context, *Message) (*SendMessageResult, error)
}

MQTTServer is the server API for MQTT service.

type Message

type Message struct {
	Topic    string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"`
	Payload  string `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"`
	Retained bool   `protobuf:"varint,3,opt,name=retained,proto3" json:"retained,omitempty"`
	// contains filtered or unexported fields
}

Message represents a message being sent to MQTT

func (*Message) Descriptor deprecated

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

Deprecated: Use Message.ProtoReflect.Descriptor instead.

func (*Message) GetPayload

func (x *Message) GetPayload() string

func (*Message) GetRetained

func (x *Message) GetRetained() bool

func (*Message) GetTopic

func (x *Message) GetTopic() string

func (*Message) ProtoMessage

func (*Message) ProtoMessage()

func (*Message) ProtoReflect added in v1.2.1

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

func (*Message) Reset

func (x *Message) Reset()

func (*Message) String

func (x *Message) String() string

type SendMessageResult

type SendMessageResult struct {
	Topic    string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"`
	Retained bool   `protobuf:"varint,2,opt,name=retained,proto3" json:"retained,omitempty"`
	// contains filtered or unexported fields
}

MessageResult represents the result of a message being sent

func (*SendMessageResult) Descriptor deprecated

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

Deprecated: Use SendMessageResult.ProtoReflect.Descriptor instead.

func (*SendMessageResult) GetRetained

func (x *SendMessageResult) GetRetained() bool

func (*SendMessageResult) GetTopic

func (x *SendMessageResult) GetTopic() string

func (*SendMessageResult) ProtoMessage

func (*SendMessageResult) ProtoMessage()

func (*SendMessageResult) ProtoReflect added in v1.2.1

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

func (*SendMessageResult) Reset

func (x *SendMessageResult) Reset()

func (*SendMessageResult) String

func (x *SendMessageResult) String() string

type Server

type Server struct {
	Debug      bool
	Port       int
	Host       string
	ConfigPath string
	Config     *viper.Viper
	Logger     log.FieldLogger
	MqttClient *mqttclient.MqttClient
	NewRelic   newrelic.Application
	// contains filtered or unexported fields
}

Server represents the server that replies to RPC messages

func NewServer

func NewServer(host string, port int, configPath string, debug bool, logger log.FieldLogger) (*Server, error)

NewServer returns a new RPC Server

func (*Server) OnErrorHandler

func (s *Server) OnErrorHandler(err error, stack []byte)

OnErrorHandler handles panics

func (*Server) SendMessage

func (s *Server) SendMessage(ctx context.Context, message *Message) (*SendMessageResult, error)

SendMessage to MQTT Server

func (*Server) Start

func (s *Server) Start() error

Start starts listening for web requests at specified host and port

type UnimplementedMQTTServer added in v1.2.1

type UnimplementedMQTTServer struct {
}

UnimplementedMQTTServer can be embedded to have forward compatible implementations.

func (*UnimplementedMQTTServer) SendMessage added in v1.2.1

Jump to

Keyboard shortcuts

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