proto

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2022 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MessageKeys = []string{
	"type",
	"connectionID",
	"subjects",
	"subject",
	"uri",
	"inbox",
	"payload",
}

MessageKeys is a list of all possible keys in a protocol message

Functions

This section is empty.

Types

type Message

type Message struct {
	Type         MessageType `json:"type"`
	ConnectionID string      `json:"connectionID"`
	Subjects     []string    `json:"subjects"`
	Subject      string      `json:"subject"`
	URI          string      `json:"uri"`
	Inbox        string      `json:"inbox"`
	Payload      []byte      `json:"payload"`
}

Message represents a message for Mantil's lambda streaming protocol.

func ParseMessage

func ParseMessage(buf []byte) (*Message, error)

ParseMessage parses a protocol message and returns a Message struct if successful

func (*Message) Encode

func (m *Message) Encode() ([]byte, error)

Encode converts a Message struct to its protocol form

type MessageType

type MessageType string

MessageType represents the type of the procol message

const (
	// Subscribe represents a subscription message type. Clients use these to indicate
	// that they want to subscribe to a set of topics.
	Subscribe MessageType = "SUB"
	// Unsubscribe represents a unsubscribe message type. Clients use these to indicate
	// that they want to unsubscribe from a set of topics.
	Unsubscribe MessageType = "UNSUB"
	// Request represents a request message type. These are used for request/response
	// type communication.
	Request MessageType = "REQ"
	// Response represents a response message type. These are used for request/response
	// type communication.
	Response MessageType = "RSP"
	// Publish represents a publish message type. These are used server-side
	// to publish a message to a given topic, sending it to all subscribers of that topic.
	Publish MessageType = "PUB"
)

Jump to

Keyboard shortcuts

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