Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Request

type Request struct {
	Name      string `json:"name"`      // The name of the shortcut, max 2 characters.
	Key       string `json:"key"`       // The key for the channel.
	Channel   string `json:"channel"`   // The channel name for the shortcut.
	Subscribe bool   `json:"subscribe"` // Specifies whether the broker should auto-subscribe.
}

Request represents a link generation request.

type Response

type Response struct {
	Request uint16 `json:"req,omitempty"`     // The corresponding request ID.
	Status  int    `json:"status"`            // The status of the response.
	Name    string `json:"name,omitempty"`    // The name of the shortcut, max 2 characters.
	Channel string `json:"channel,omitempty"` // The channel which was registered.
}

Response represents a link generation response.

func (*Response) ForRequest

func (r *Response) ForRequest(id uint16)

ForRequest sets the request ID in the response for matching

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service represents a link generation service.

func New

func New(auth service.Authorizer, pubsub service.PubSub) *Service

New creates a new link generation service.

func (*Service) OnRequest

func (s *Service) OnRequest(c service.Conn, payload []byte) (service.Response, bool)

OnRequest handles a request to create a link.