Documentation ¶
Index ¶
- Constants
- type Device
- type GetClientActiveDevicesRequest
- type SendEventToClientChannelRequest
- type SendEventToClientDeviceChannelRequest
- type SendEventToTopicRequest
- type SendEventToTopicsRequest
- type Service
- func (c *Service) AsyncClientSubscribe(ctx context.Context, clientID string, device *Device) (*subscription.Subscription, error)
- func (c *Service) ClientUnsubscribe(ctx context.Context, clientID string, subscription *subscription.Subscription, ...) error
- func (c *Service) ConfirmEventReceipt(ctx context.Context, eventName string)
- func (c *Service) GetClientActiveDevices(ctx context.Context, req GetClientActiveDevicesRequest) ([]Device, error)
- func (c *Service) IsDeviceValidationMessage(eventName string) bool
- func (c *Service) PublishToClient(ctx context.Context, req SendEventToClientChannelRequest) error
- func (c *Service) PublishToClientWithDevice(ctx context.Context, req SendEventToClientDeviceChannelRequest) error
- func (c *Service) PublishToTopic(ctx context.Context, req SendEventToTopicRequest) error
- func (c *Service) PublishToTopics(ctx context.Context, req SendEventToTopicsRequest) error
- func (c *Service) TopicSubscribe(ctx context.Context, topic string, ...) error
- func (c *Service) TopicUnsubscribe(ctx context.Context, topic string, ...) error
- func (c *Service) TriggerTestPayloadToTopic(ctx context.Context, topic string)
- type TopicSubscriptionRequest
- type TopicUnSubscriptionRequest
Constants ¶
const ( // DeviceValidation is topic name for device validation messages DeviceValidation string = "DEVICE_VALIDATION" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GetClientActiveDevicesRequest ¶
type GetClientActiveDevicesRequest struct {
// contains filtered or unexported fields
}
GetClientActiveDevicesRequest model
func (*GetClientActiveDevicesRequest) PopulateFromProto ¶
func (g *GetClientActiveDevicesRequest) PopulateFromProto(ctx context.Context, proto *pushv1.GetClientActiveDevicesRequest) error
PopulateFromProto maps model from proto
type SendEventToClientChannelRequest ¶
type SendEventToClientChannelRequest struct {
// contains filtered or unexported fields
}
SendEventToClientChannelRequest model
func (*SendEventToClientChannelRequest) PopulateFromProto ¶
func (smu *SendEventToClientChannelRequest) PopulateFromProto(ctx context.Context, protoRequest *pushv1.SendEventToClientChannelRequest) error
PopulateFromProto maps model from proto
type SendEventToClientDeviceChannelRequest ¶
type SendEventToClientDeviceChannelRequest struct {
// contains filtered or unexported fields
}
SendEventToClientDeviceChannelRequest model
func (*SendEventToClientDeviceChannelRequest) PopulateFromProto ¶
func (smu *SendEventToClientDeviceChannelRequest) PopulateFromProto(ctx context.Context, protoRequest *pushv1.SendEventToClientDeviceChannelRequest) error
PopulateFromProto maps model from proto
type SendEventToTopicRequest ¶
SendEventToTopicRequest model
func (*SendEventToTopicRequest) PopulateFromProto ¶
func (smt *SendEventToTopicRequest) PopulateFromProto(ctx context.Context, protoRequest *pushv1.SendEventToTopicRequest) error
PopulateFromProto maps model from proto
type SendEventToTopicsRequest ¶
type SendEventToTopicsRequest struct {
// contains filtered or unexported fields
}
SendEventToTopicsRequest model
func (*SendEventToTopicsRequest) PopulateFromProto ¶
func (sm *SendEventToTopicsRequest) PopulateFromProto(ctx context.Context, proto *pushv1.SendEventToTopicsRequest) error
PopulateFromProto maps model from proto
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service of the push service
func NewService ¶
NewService returns a new instance of Service
func (*Service) AsyncClientSubscribe ¶
func (c *Service) AsyncClientSubscribe(ctx context.Context, clientID string, device *Device) (*subscription.Subscription, error)
AsyncClientSubscribe to the client
func (*Service) ClientUnsubscribe ¶
func (c *Service) ClientUnsubscribe(ctx context.Context, clientID string, subscription *subscription.Subscription, device *Device) error
ClientUnsubscribe unsubscribes a client
func (*Service) ConfirmEventReceipt ¶
ConfirmEventReceipt is just used for instrumentation
func (*Service) GetClientActiveDevices ¶
func (c *Service) GetClientActiveDevices(ctx context.Context, req GetClientActiveDevicesRequest) ([]Device, error)
GetClientActiveDevices ...
┌──────┐ 2. subscribe(clnt, clnt-device) │ │◄──────────┐ ┌───►│redis │ │ ┌───────────┐ │ │pubsub├──────┐ │ ┌───┐ │ ├──┘ ├───▲──┘ │ │ │ │1. connect │ │ │ │ │ │ │app├────────────►│propeller │◄──────┘ │ │ │ │ │ │ │9. │ │ │8. └───┘ │ ├───────────┘ │ │ │ │10. validation resp │ │validation └───────────┴──┐ ┌───────┐ │ │message │ │ │ │ │published 3. store(clnt, device, attrs) │ │ redis │ │ │ └───►│ kv │ │11. │ │ │ │ │ └───────┘ │ │ 5. devices = load(clnt) │ │ 13.delete stale entries ┌──────┐ │ │ ┌────────────┐ │ │ │ │ │ ├─────►│redis │ │ │ ┌───┐ │ │ │ kv │ │ │ │ │4.getDevices │ │ └──────┘ │ │ │ BE├────────────►│propeller │12. validation recv │ │ │ │ │ │◄─────┬──────┐ │ │ │ │14. reply │ │6. │ │◄─────┘ │ │ │◄────────────┤ ├─────►│redis │ │ └───┘ │ │7. │pubsub├───────────┘ └────────────┴─────►└──────┘ 6. subscribe(clnt-device-resp) 7. publishToTopic(clnt-device, validation message)
func (*Service) IsDeviceValidationMessage ¶
IsDeviceValidationMessage checks if the message is device validation message
func (*Service) PublishToClient ¶
func (c *Service) PublishToClient(ctx context.Context, req SendEventToClientChannelRequest) error
PublishToClient publishes to the client
func (*Service) PublishToClientWithDevice ¶
func (c *Service) PublishToClientWithDevice(ctx context.Context, req SendEventToClientDeviceChannelRequest) error
PublishToClientWithDevice publishes to the client with device
func (*Service) PublishToTopic ¶
func (c *Service) PublishToTopic(ctx context.Context, req SendEventToTopicRequest) error
PublishToTopic publishes to the topic
func (*Service) PublishToTopics ¶
func (c *Service) PublishToTopics(ctx context.Context, req SendEventToTopicsRequest) error
PublishToTopics publishes to multiple topics in bulk
func (*Service) TopicSubscribe ¶
func (c *Service) TopicSubscribe(ctx context.Context, topic string, clientSubscription *subscription.Subscription) error
TopicSubscribe to the topic
func (*Service) TopicUnsubscribe ¶
func (c *Service) TopicUnsubscribe(ctx context.Context, topic string, clientSubscription *subscription.Subscription) error
TopicUnsubscribe to unsubscribe from a topic
type TopicSubscriptionRequest ¶
type TopicSubscriptionRequest struct {
// contains filtered or unexported fields
}
TopicSubscriptionRequest model
type TopicUnSubscriptionRequest ¶
type TopicUnSubscriptionRequest struct {
// contains filtered or unexported fields
}
TopicUnSubscriptionRequest model