Documentation
¶
Overview ¶
Package http contains the domain concept definitions needed to support SuperMQ HTTP Adapter functionality.
Index ¶
Constants ¶
View Source
const ( LogInfoSubscribed = "subscribed with client_id %s to topics %s" LogInfoConnected = "connected with client_id %s" LogInfoDisconnected = "disconnected client_id %s and username %s" LogInfoPublished = "published with client_id %s to the topic %s" )
Log message formats.
Variables ¶
View Source
var ( // ErrFailedSubscription indicates that client couldn't subscribe to specified channel. ErrFailedSubscription = errors.New("failed to subscribe to a channel") // ErrFailedPublish indicates that client couldn't publish to specified channel. ErrFailedSubscribe = errors.New("failed to unsubscribe from topic") // ErrEmptyTopic indicate absence of clientKey in the request. ErrEmptyTopic = errors.New("empty topic") )
Functions ¶
func NewHandler ¶
func NewHandler(pubsub messaging.PubSub, logger *slog.Logger, authn smqauthn.Authentication, clients grpcClientsV1.ClientsServiceClient, channels grpcChannelsV1.ChannelsServiceClient, parser messaging.TopicParser) session.Handler
NewHandler creates new Handler entity.
Types ¶
type Client ¶ added in v0.18.4
type Client struct {
// contains filtered or unexported fields
}
Client handles messaging and websocket connection.
func (*Client) Cancel ¶ added in v0.18.4
Cancel handles the websocket connection after unsubscribing.
func (*Client) Handle ¶ added in v0.18.4
Handle handles the sending and receiving of messages via the broker.
func (*Client) SetCloseHandler ¶ added in v0.18.4
SetCloseHandler sets a close handler for the WebSocket connection.
type Service ¶ added in v0.18.4
type Service interface {
// Subscribe subscribes message from the broker using the clientKey for authorization,
// the channelID for subscription and domainID specifies the domain for authorization.
// Subtopic is optional.
// If the subscription is successful, nil is returned otherwise error is returned.
Subscribe(ctx context.Context, sessionID, username, password, domainID, chanID, subtopic string, topicType messaging.TopicType, client *Client) error
Unsubscribe(ctx context.Context, sessionID, domainID, chanID, subtopic string, topicType messaging.TopicType) error
}
Service specifies web socket service API.
func NewService ¶ added in v0.18.4
func NewService(clients grpcClientsV1.ClientsServiceClient, channels grpcChannelsV1.ChannelsServiceClient, authn smqauthn.Authentication, pubsub messaging.PubSub) Service
NewService instantiates the HTTP 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 middleware provides logging, metrics and tracing middleware for SuperMQ HTTP service.
|
Package middleware provides logging, metrics and tracing middleware for SuperMQ HTTP service. |
Click to show internal directories.
Click to hide internal directories.