Documentation ¶
Overview ¶
Package coap contains the domain concept definitions needed to support Magistrala CoAP adapter service functionality. All constant values are taken from RFC, and could be adjusted based on specific use case.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrOption = errors.New("unable to set option")
ErrOption indicates an error when adding an option.
View Source
var ErrUnsubscribe = errors.New("unable to unsubscribe")
ErrUnsubscribe indicates an error to unsubscribe.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { // In CoAP terminology, Token similar to the Session ID. Token() string // Handle handles incoming messages. Handle(m *messaging.Message) error // Cancel cancels the client. Cancel() error // Done returns a channel that's closed when the client is done. Done() <-chan struct{} }
Client wraps CoAP client.
type Service ¶
type Service interface { // Publish publishes message to specified channel. // Key is used to authorize publisher. Publish(ctx context.Context, key string, msg *messaging.Message) error // Subscribes to channel with specified id, subtopic and adds subscription to // service map of subscriptions under given ID. Subscribe(ctx context.Context, key, chanID, subtopic string, c Client) error // Unsubscribe method is used to stop observing resource. Unsubscribe(ctx context.Context, key, chanID, subptopic, token string) error }
Service specifies CoAP service API.
func New ¶
func New(authClient magistrala.AuthzServiceClient, pubsub messaging.PubSub) Service
New instantiates the CoAP adapter implementation.
Directories ¶
Path | Synopsis |
---|---|
Package api contains API-related concerns: endpoint definitions, middlewares and all resource representations.
|
Package api contains API-related concerns: endpoint definitions, middlewares and all resource representations. |
Package tracing provides tracing instrumentation for Magistrala WebSocket adapter service.
|
Package tracing provides tracing instrumentation for Magistrala WebSocket adapter service. |
Click to show internal directories.
Click to hide internal directories.