package observation
import "github.com/plgd-dev/go-coap/v3/net/observation"
Index ¶
- Constants
- func ValidSequenceNumber(oldValue, newValue uint32, lastEventOccurs time.Time, now time.Time) bool
- type Client
- type DoFunc
- type Handler
- func NewHandler[C Client](cc C, next HandlerFunc[C], do DoFunc) *Handler[C]
- func (h *Handler[C]) GetObservation(key uint64) (*Observation[C], bool)
- func (h *Handler[C]) GetObservationRequest(token message.Token) (*pool.Message, bool)
- func (h *Handler[C]) Handle(w *responsewriter.ResponseWriter[C], r *pool.Message)
- func (h *Handler[C]) NewObservation(req *pool.Message, observeFunc func(req *pool.Message)) (*Observation[C], error)
- type HandlerFunc
- type Observation
Constants ¶
ObservationSequenceTimeout defines how long is sequence number is valid. https://tools.ietf.org/html/rfc7641#section-3.4
Functions ¶
func ValidSequenceNumber ¶
ValidSequenceNumber implements conditions in https://tools.ietf.org/html/rfc7641#section-3.4
Types ¶
type Client ¶
type Client interface { Context() context.Context WriteMessage(req *pool.Message) error ReleaseMessage(msg *pool.Message) AcquireMessage(ctx context.Context) *pool.Message }
type DoFunc ¶
type Handler ¶
type Handler[C Client] struct { // contains filtered or unexported fields }
func NewHandler ¶
func NewHandler[C Client](cc C, next HandlerFunc[C], do DoFunc) *Handler[C]
func (*Handler[C]) GetObservation ¶
func (h *Handler[C]) GetObservation(key uint64) (*Observation[C], bool)
func (*Handler[C]) GetObservationRequest ¶
GetObservationRequest returns observation request for token
func (*Handler[C]) Handle ¶
func (h *Handler[C]) Handle(w *responsewriter.ResponseWriter[C], r *pool.Message)
func (*Handler[C]) NewObservation ¶
func (h *Handler[C]) NewObservation(req *pool.Message, observeFunc func(req *pool.Message)) (*Observation[C], error)
type HandlerFunc ¶
type HandlerFunc[C Client] func(*responsewriter.ResponseWriter[C], *pool.Message)
The HandlerFunc type is an adapter to allow the use of ordinary functions as COAP handlers.
type Observation ¶
type Observation[C Client] struct { // contains filtered or unexported fields }
Observation represents subscription to resource on the server
func (*Observation[C]) Cancel ¶
Cancel remove observation from server. For recreate observation use Observe.
func (*Observation[C]) Canceled ¶
func (o *Observation[C]) Canceled() bool
func (*Observation[C]) Request ¶
func (o *Observation[C]) Request() message.Message
Source Files ¶
- Version
- v3.3.6 (latest)
- Published
- Sep 18, 2024
- Platform
- linux/amd64
- Imports
- 12 packages
- Last checked
- 1 week ago –
Tools for package owners.