Documentation
¶
Overview ¶
Package rest provides an HTTP/SSE gateway that bridges a DDS participant to HTTP clients.
Subscribers receive a real-time Server-Sent Events (SSE) stream over GET /topics/{topic}; publishers POST raw bytes to /topics/{topic}; and GET /topics lists all currently-subscribed topics as JSON.
Usage:
p, _ := rtps.New(dds.Domain(0))
bridge := rest.New(p, rest.Options{})
http.ListenAndServe(":8090", bridge)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bridge ¶
type Bridge struct {
// contains filtered or unexported fields
}
Bridge exposes a DDS participant over HTTP. It is safe for concurrent use.
func New ¶
func New(p dds.Participant, opts Options) *Bridge
New creates a Bridge wrapping p. Subscribers and publishers are created lazily on first request.
type Options ¶
type Options struct {
// AuthToken, if non-empty, requires every request to carry the header
// Authorization: Bearer <AuthToken>
// Requests without a valid token receive 401 Unauthorized.
AuthToken string
// QoS is applied to all subscribers and publishers created by the bridge.
// Zero value uses dds.DefaultQoS.
QoS dds.QoS
// SSEKeepalive is how often a comment (:keepalive) line is written to idle
// SSE streams to prevent proxy timeouts. Default: 15s. Zero disables.
SSEKeepalive time.Duration
}
Options configures a Bridge.
Click to show internal directories.
Click to hide internal directories.