responsewriter

package
v3.3.4 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	ReleaseMessage(msg *pool.Message)
}

type ResponseWriter

type ResponseWriter[C Client] struct {
	// contains filtered or unexported fields
}

A ResponseWriter is used by an COAP handler to construct an COAP response.

func New

func New[C Client](response *pool.Message, cc C, requestOptions ...message.Option) *ResponseWriter[C]

func (*ResponseWriter[C]) Conn

func (r *ResponseWriter[C]) Conn() C

CConn peer connection.

func (*ResponseWriter[C]) Message

func (r *ResponseWriter[C]) Message() *pool.Message

Message direct access to the response.

func (*ResponseWriter[C]) SetMessage

func (r *ResponseWriter[C]) SetMessage(m *pool.Message)

SetMessage replaces the response message. The original message was released to the message pool, so don't use it any more. Ensure that Token, MessageID(udp), and Type(udp) messages are paired correctly.

func (*ResponseWriter[C]) SetResponse

func (r *ResponseWriter[C]) SetResponse(code codes.Code, contentFormat message.MediaType, d io.ReadSeeker, opts ...message.Option) error

SetResponse simplifies the setup of the response for the request. ETags must be set via options. For advanced setup, use Message().

func (*ResponseWriter[C]) Swap added in v3.1.1

func (r *ResponseWriter[C]) Swap(m *pool.Message) *pool.Message

Swap message in response without releasing.

Jump to

Keyboard shortcuts

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