Documentation ¶
Overview ¶
Package coap contains the domain concept definitions needed to support Mainflux coap adapter service functionality. All constant values are taken from RFC, and could be adjusted based on specific use case.
Index ¶
Constants ¶
View Source
const ( // AckRandomFactor is default ACK coefficient. AckRandomFactor = 1.5 // AckTimeout is the amount of time to wait for a response. AckTimeout = 2000 * time.Millisecond // MaxRetransmit is the maximum number of times a message will be retransmitted. MaxRetransmit = 4 )
Variables ¶
View Source
var ( // ErrFailedMessagePublish indicates that message publishing failed. ErrFailedMessagePublish = errors.New("failed to publish message") // ErrFailedSubscription indicates that client couldn't subscribe to specified channel. ErrFailedSubscription = errors.New("failed to subscribe to a channel") // ErrFailedConnection indicates that service couldn't connect to message broker. ErrFailedConnection = errors.New("failed to connect to message broker") )
Functions ¶
This section is empty.
Types ¶
type Broker ¶
type Broker interface { mainflux.MessagePublisher // Subscribes to channel with specified id, subtopic and adds subscription to // service map of subscriptions under given ID. Subscribe(string, string, string, *Observer) error }
Broker represents NATS broker instance.
type Observer ¶
type Observer struct { // Messages is used to receive messages from NATS. Messages chan mainflux.RawMessage // Cancel channel is used to cancel observing resource. // Cancel channel should not be used to send or receive any // data, it's purpose is to be closed once Observer canceled. Cancel chan bool // contains filtered or unexported fields }
Observer is used to handle CoAP subscription.
func (*Observer) LoadExpired ¶
LoadExpired reads Expired flag in thread-safe way.
func (*Observer) LoadMessageID ¶
LoadMessageID reads MessageID and increments its value in thread-safe way.
func (*Observer) StoreExpired ¶
StoreExpired stores Expired flag in thread-safe way.
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 nats contains NATS message publisher implementation.
|
Package nats contains NATS message publisher implementation. |
Click to show internal directories.
Click to hide internal directories.