data

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: GPL-3.0 Imports: 10 Imported by: 7 modules, 10 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// WSRoute is the route which data will be sent over websocket
	WSRoute = "/save"
	// ModeServer is a constant value that is used to indicate that the WebSocket host should start in server mode, meaning it will listen for incoming connections from clients and respond to them.
	ModeServer = "server"
	// ModeClient is a constant value that is used to indicate that the WebSocket host should start in client mode, meaning it will initiate connections to a remote server.
	ModeClient = "client"
)
View Source
const (
	// AckMessage holds the identifier for an ack messages
	AckMessage = 1
	// PayloadMessage holds the identifier for a payload message
	PayloadMessage = 2
)
View Source
const (
	// ClosedConnectionMessage is the message that is received when try to send a message over a closed WebSocket connection
	ClosedConnectionMessage = "use of closed network connection"
)

Variables

View Source
var (
	ErrInvalidLengthWsMessage        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowWsMessage          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupWsMessage = fmt.Errorf("proto: unexpected end of group")
)
View Source
var ErrAckTimeout = errors.New("acknowledge waiting timeout occurred")

ErrAckTimeout signals that an acknowledgment timeout has been reached

View Source
var ErrConnectionAlreadyOpen = errors.New("connection already open")

ErrConnectionAlreadyOpen signal that the WebSocket connection was already open

View Source
var ErrConnectionNotOpen = errors.New("connection not open")

ErrConnectionNotOpen signal that the WebSocket connection is not open

View Source
var ErrEmptyUrl = errors.New("empty websocket url provided")

ErrEmptyUrl signals that an empty websocket url has been provided

View Source
var ErrExpectedAckWasNotReceivedOnClose = errors.New("expected ack message was not received on close")

ErrExpectedAckWasNotReceivedOnClose signals that the acknowledgment message was not received at close

View Source
var ErrInvalidWebSocketHostMode = errors.New("invalid web socket host mode")

ErrInvalidWebSocketHostMode signals that the provided mode is invalid

View Source
var ErrNilMarshaller = errors.New("nil marshaller")

ErrNilMarshaller signals that a nil marshaller has been provided

View Source
var ErrNilPayloadConverter = errors.New("nil payload converter provided")

ErrNilPayloadConverter signals that a nil payload converter has been provided

View Source
var ErrNilPayloadProcessor = errors.New("nil payload processor provided")

ErrNilPayloadProcessor signals that a nil payload processor has been provided

View Source
var ErrNoClientsConnected = errors.New("no client connected")

ErrNoClientsConnected is an error signal indicating the absence of any connected clients

View Source
var ErrServerIsClosed = errors.New("http: Server closed")

ErrServerIsClosed represents the error thrown by the server's ListenAndServe() function when the server is closed

View Source
var ErrZeroValueAckTimeout = errors.New("zero value provided for acknowledge timeout")

ErrZeroValueAckTimeout signals that a zero value for acknowledge timeout has been provided

View Source
var ErrZeroValueRetryDuration = errors.New("zero value provided for retry duration")

ErrZeroValueRetryDuration signals that a zero value for retry duration has been provided

Functions

This section is empty.

Types

type WSConn

type WSConn interface {
	io.Closer
	ReadMessage() (messageType int, payload []byte, err error)
	WriteMessage(messageType int, data []byte) error
}

WSConn defines what a sender shall do

type WebSocketConfig

type WebSocketConfig struct {
	URL                        string // The WebSocket URL to connect to.
	Mode                       string // The host operation mode: 'client' or 'server'.
	RetryDurationInSec         int    // The duration in seconds to wait before retrying the connection in case of failure.
	WithAcknowledge            bool   // Set to `true` to enable message acknowledgment mechanism.
	AcknowledgeTimeoutInSec    int    // The duration in seconds to wait for an acknowledgement message
	BlockingAckOnError         bool   // Set to `true` to send the acknowledgment message only if the processing part of a message succeeds. If an error occurs during processing, the acknowledgment will not be sent.
	DropMessagesIfNoConnection bool   // Set to `true` to drop messages if there is no active WebSocket connection to send to.
	Version                    uint32 // Defines the payload version.
}

WebSocketConfig holds the configuration needed for instantiating a new web socket server

type WsMessage

type WsMessage struct {
	WithAcknowledge bool   `protobuf:"varint,1,opt,name=WithAcknowledge,proto3" json:"withAcknowledge,omitempty"`
	Counter         uint64 `protobuf:"varint,2,opt,name=Counter,proto3" json:"counter,omitempty"`
	Type            int32  `protobuf:"varint,3,opt,name=Type,proto3" json:"type,omitempty"`
	Payload         []byte `protobuf:"bytes,4,opt,name=Payload,proto3" json:"payload,omitempty"`
	Topic           string `protobuf:"bytes,5,opt,name=Topic,proto3" json:"topic,omitempty"`
	Version         uint32 `protobuf:"varint,6,opt,name=Version,proto3" json:"version,omitempty"`
}

WsMessage contains all the information needed for a WebSocket message

func (*WsMessage) Descriptor

func (*WsMessage) Descriptor() ([]byte, []int)

func (*WsMessage) Equal

func (this *WsMessage) Equal(that interface{}) bool

func (*WsMessage) GetCounter

func (m *WsMessage) GetCounter() uint64

func (*WsMessage) GetPayload

func (m *WsMessage) GetPayload() []byte

func (*WsMessage) GetTopic

func (m *WsMessage) GetTopic() string

func (*WsMessage) GetType

func (m *WsMessage) GetType() int32

func (*WsMessage) GetVersion added in v1.0.7

func (m *WsMessage) GetVersion() uint32

func (*WsMessage) GetWithAcknowledge

func (m *WsMessage) GetWithAcknowledge() bool

func (*WsMessage) GoString

func (this *WsMessage) GoString() string

func (*WsMessage) Marshal

func (m *WsMessage) Marshal() (dAtA []byte, err error)

func (*WsMessage) MarshalTo

func (m *WsMessage) MarshalTo(dAtA []byte) (int, error)

func (*WsMessage) MarshalToSizedBuffer

func (m *WsMessage) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*WsMessage) ProtoMessage

func (*WsMessage) ProtoMessage()

func (*WsMessage) Reset

func (m *WsMessage) Reset()

func (*WsMessage) Size

func (m *WsMessage) Size() (n int)

func (*WsMessage) String

func (this *WsMessage) String() string

func (*WsMessage) Unmarshal

func (m *WsMessage) Unmarshal(dAtA []byte) error

func (*WsMessage) XXX_DiscardUnknown

func (m *WsMessage) XXX_DiscardUnknown()

func (*WsMessage) XXX_Marshal

func (m *WsMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*WsMessage) XXX_Merge

func (m *WsMessage) XXX_Merge(src proto.Message)

func (*WsMessage) XXX_Size

func (m *WsMessage) XXX_Size() int

func (*WsMessage) XXX_Unmarshal

func (m *WsMessage) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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