message

package
v2.5.1 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONTime

type JSONTime time.Time

JSONTime represent an timestamp

func (JSONTime) MarshalJSON

func (t JSONTime) MarshalJSON() ([]byte, error)

MarshalJSON will mashall an timestamp

func (*JSONTime) UnmarshalJSON

func (t *JSONTime) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON unmashall the timestapm

type Message

type Message struct {

	// SendAsJSON will send this message as json to the Topic
	SendAsJSON bool `json:"o,omitempty"`

	// ReqID [OPTIONAL] represents the current request
	ReqID string `json:"r,omitempty"`

	// The topic
	Timestamp JSONTime `json:"s,omitempty"`

	// The topic
	Topic string `json:"t,omitempty"`

	// TopicReply [OPTIONAL] - the request should reply with this topic
	TopicReply string `json:"tr,omitempty"`

	// payload
	Payload string `json:"v"`
	// contains filtered or unexported fields
}

Message represent a single message from/to SSE

func NewJSON

func NewJSON(jsonString string) (Message, error)

NewJSON will convert an json-string to an message

func (*Message) JSONString

func (curMessage *Message) JSONString() (string, error)

JSONString will convert an message to an json string

func (Message) MarshalZerologObject

func (curMessage Message) MarshalZerologObject(e *zerolog.Event)

MarshalZerologObject implementation to use it with Object()

Jump to

Keyboard shortcuts

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