message

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2023 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsEventDelivery

func IsEventDelivery(msg *Message) bool

func IsEventPublish

func IsEventPublish(msg *Message) bool

func IsMetaMessage

func IsMetaMessage(msg *Message) bool

Types

type Advise

type Advise struct {
	Reconnect       Reconnect     `json:"reconnect,omitempty"`
	Interval        time.Duration `json:"interval,omitempty"`
	Timeout         time.Duration `json:"timeout,omitempty"`
	MultipleClients bool          `json:"multiple-clients,omitempty"`
	Hosts           []string      `json:"hosts,omitempty"`
}

func (*Advise) MarshalJSON

func (a *Advise) MarshalJSON() ([]byte, error)

func (*Advise) UnmarshalJSON

func (a *Advise) UnmarshalJSON(b []byte) error

type Data

type Data = interface{}

type EventMessage

type EventMessage = int

EventMessage are published in event messages sent from a faye client to a faye server and are delivered in event messages sent from a faye server to a faye client.

const (
	//
	EventPublish EventMessage = iota
	EventDelivery
)

type Extension

type Extension func(message *Message)

type Extensions

type Extensions struct {
	In  []Extension
	Out []Extension
}

func (*Extensions) ApplyInExtensions

func (e *Extensions) ApplyInExtensions(m *Message)

func (*Extensions) ApplyOutExtensions

func (e *Extensions) ApplyOutExtensions(m *Message)

type Message

type Message struct {
	Channel                  string      `json:"channel,omitempty"`
	Version                  string      `json:"version,omitempty"`
	SupportedConnectionTypes []string    `json:"supportedConnectionTypes,omitempty"`
	ConnectionType           string      `json:"connectionType,omitempty"`
	MinimumVersion           string      `json:"minimumVersion,omitempty"`
	Successful               bool        `json:"successful,omitempty"`
	Ext                      interface{} `json:"ext,omitempty"`
	Id                       string      `json:"id,omitempty"`
	ClientId                 string      `json:"clientId,omitempty"`
	Advice                   *Advise     `json:"advice,omitempty"`
	Data                     Data        `json:"data,omitempty"`
	Timestamp                uint64      `json:"timestamp,omitempty"`
	AuthSuccessful           bool        `json:"authSuccessful,omitempty"`
	Error                    string      `json:"error,omitempty"`
	Subscription             string      `json:"subscription,omitempty"`
}

func (*Message) GetError

func (m *Message) GetError() error

type MetaMessage

type MetaMessage = string

MetaMessage are channels commencing with the /meta/ segment ans, are the channels used by the faye protocol itself.

const (
	MetaSubscribe   MetaMessage = "/meta/subscribe"
	MetaConnect     MetaMessage = "/meta/connect"
	MetaDisconnect  MetaMessage = "/meta/disconnect"
	MetaUnsubscribe MetaMessage = "/meta/unsubscribe"
	MetaHandshake   MetaMessage = "/meta/handshake"
)

type Reconnect

type Reconnect string
const (
	//ReconnectRetry indicates that a client MAY attempt to reconnect with a /meta/connect message,
	//after the interval (as defined by interval advice field or client-default backoff), and with the same credentials.
	ReconnectRetry Reconnect = "retry"

	//ReconnectHandshake indicates that the server has terminated any prior connection status and the client MUST reconnect
	// with a /meta/handshake message.
	//A client MUST NOT automatically retry when a reconnect advice handshake has been received.
	ReconnectHandshake Reconnect = "handshake"

	//ReconnectNone indicates a hard failure for the connect attempt.
	//A client MUST respect reconnect advice none and MUST NOT automatically retry or handshake.
	ReconnectNone Reconnect = "none"
)

Jump to

Keyboard shortcuts

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