protocol

package
v3.32.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package protocol implements the protocol for the events package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorResponse

type ErrorResponse struct {
	ID    uint64
	Error *status.Status
}

ErrorResponse is the response to an error.

func (ErrorResponse) MarshalJSON

func (m ErrorResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*ErrorResponse) UnmarshalJSON

func (m *ErrorResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type MessageType

type MessageType int

MessageType is the type of a message.

const (
	// MessageTypeSubscribe is the type of a subscribe message.
	MessageTypeSubscribe MessageType = iota
	// MessageTypeUnsubscribe is the type of an unsubscribe message.
	MessageTypeUnsubscribe
	// MessageTypePublish is the type of a publish message.
	MessageTypePublish
	// MessageTypeError is the type of an error message.
	MessageTypeError
)

func (MessageType) MarshalJSON

func (m MessageType) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*MessageType) UnmarshalJSON

func (m *MessageType) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type PublishResponse

type PublishResponse struct {
	ID    uint64       `json:"id"`
	Event *ttnpb.Event `json:"event"`
}

PublishResponse is the request to publish an event.

func (PublishResponse) MarshalJSON

func (m PublishResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

type Request

type Request interface {
	// contains filtered or unexported methods
}

Request is a request message.

type RequestWrapper

type RequestWrapper struct {
	Contents Request
}

RequestWrapper wraps a request to be sent over the websocket.

func (RequestWrapper) MarshalJSON

func (m RequestWrapper) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*RequestWrapper) UnmarshalJSON

func (m *RequestWrapper) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Response

type Response interface {
	// contains filtered or unexported methods
}

Response is a response message.

type ResponseWrapper

type ResponseWrapper struct {
	Contents Response
}

ResponseWrapper wraps a response to be sent over the websocket.

func (ResponseWrapper) MarshalJSON

func (m ResponseWrapper) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*ResponseWrapper) UnmarshalJSON

func (m *ResponseWrapper) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type SubscribeRequest

type SubscribeRequest struct {
	ID          uint64                     `json:"id"`
	Identifiers []*ttnpb.EntityIdentifiers `json:"identifiers"`
	Tail        uint32                     `json:"tail"`
	After       *time.Time                 `json:"after"`
	Names       []string                   `json:"names"`
}

SubscribeRequest is the request to subscribe to events.

func (SubscribeRequest) MarshalJSON

func (m SubscribeRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (SubscribeRequest) Response

func (m SubscribeRequest) Response(err error) Response

Response builds a response to the request.

type SubscribeResponse

type SubscribeResponse struct {
	ID uint64 `json:"id"`
}

SubscribeResponse is the response to a subscribe request.

func (SubscribeResponse) MarshalJSON

func (m SubscribeResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

type UnsubscribeRequest

type UnsubscribeRequest struct {
	ID uint64 `json:"id"`
}

UnsubscribeRequest is the request to unsubscribe from events.

func (UnsubscribeRequest) MarshalJSON

func (m UnsubscribeRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (UnsubscribeRequest) Response

func (m UnsubscribeRequest) Response(err error) Response

Response builds a response to the request.

type UnsubscribeResponse

type UnsubscribeResponse struct {
	ID uint64 `json:"id"`
}

UnsubscribeResponse is the response to an unsubscribe request.

func (UnsubscribeResponse) MarshalJSON

func (m UnsubscribeResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

Jump to

Keyboard shortcuts

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