encoders

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CachedEncodedMessage added in v1.2.3

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

func NewCachedEncodedMessage added in v1.2.3

func NewCachedEncodedMessage(msg EncodedMessage) *CachedEncodedMessage

func (*CachedEncodedMessage) Fetch added in v1.2.3

func (msg *CachedEncodedMessage) Fetch(id string, callback EncodingFunction) (*ws.SentFrame, error)

func (*CachedEncodedMessage) GetType added in v1.2.3

func (msg *CachedEncodedMessage) GetType() string

func (*CachedEncodedMessage) MarshalJSON added in v1.2.3

func (msg *CachedEncodedMessage) MarshalJSON() ([]byte, error)

type EncodedMessage

type EncodedMessage interface {
	GetType() string
}

type Encoder

type Encoder interface {
	ID() string
	Encode(msg EncodedMessage) (*ws.SentFrame, error)
	EncodeTransmission(msg string) (*ws.SentFrame, error)
	Decode(payload []byte) (*common.Message, error)
}

type EncodingCache added in v1.2.3

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

func NewEncodingCache added in v1.2.3

func NewEncodingCache() *EncodingCache

func (*EncodingCache) Fetch added in v1.2.3

func (m *EncodingCache) Fetch(
	msg EncodedMessage,
	encoder string,
	callback EncodingFunction,
) (*ws.SentFrame, error)

type EncodingFunction added in v1.2.3

type EncodingFunction = func(EncodedMessage) (*ws.SentFrame, error)

type JSON

type JSON struct {
}

func (JSON) Decode

func (JSON) Decode(raw []byte) (*common.Message, error)

func (JSON) Encode

func (JSON) Encode(msg EncodedMessage) (*ws.SentFrame, error)

func (JSON) EncodeTransmission

func (JSON) EncodeTransmission(msg string) (*ws.SentFrame, error)

func (JSON) ID

func (JSON) ID() string

Jump to

Keyboard shortcuts

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