Documentation ¶
Index ¶
- Constants
- Variables
- type WSConn
- type WebSocketConfig
- type WsMessage
- func (*WsMessage) Descriptor() ([]byte, []int)
- func (this *WsMessage) Equal(that interface{}) bool
- func (m *WsMessage) GetCounter() uint64
- func (m *WsMessage) GetPayload() []byte
- func (m *WsMessage) GetTopic() string
- func (m *WsMessage) GetType() int32
- func (m *WsMessage) GetVersion() uint32
- func (m *WsMessage) GetWithAcknowledge() bool
- func (this *WsMessage) GoString() string
- func (m *WsMessage) Marshal() (dAtA []byte, err error)
- func (m *WsMessage) MarshalTo(dAtA []byte) (int, error)
- func (m *WsMessage) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*WsMessage) ProtoMessage()
- func (m *WsMessage) Reset()
- func (m *WsMessage) Size() (n int)
- func (this *WsMessage) String() string
- func (m *WsMessage) Unmarshal(dAtA []byte) error
- func (m *WsMessage) XXX_DiscardUnknown()
- func (m *WsMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *WsMessage) XXX_Merge(src proto.Message)
- func (m *WsMessage) XXX_Size() int
- func (m *WsMessage) XXX_Unmarshal(b []byte) error
Constants ¶
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" )
const ( // AckMessage holds the identifier for an ack messages AckMessage = 1 // PayloadMessage holds the identifier for a payload message PayloadMessage = 2 )
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 ¶
var ( ErrInvalidLengthWsMessage = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowWsMessage = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupWsMessage = fmt.Errorf("proto: unexpected end of group") )
var ErrAckTimeout = errors.New("acknowledge waiting timeout occurred")
ErrAckTimeout signals that an acknowledgment timeout has been reached
var ErrConnectionAlreadyOpen = errors.New("connection already open")
ErrConnectionAlreadyOpen signal that the WebSocket connection was already open
var ErrConnectionNotOpen = errors.New("connection not open")
ErrConnectionNotOpen signal that the WebSocket connection is not open
var ErrEmptyUrl = errors.New("empty websocket url provided")
ErrEmptyUrl signals that an empty websocket url has been provided
var ErrExpectedAckWasNotReceivedOnClose = errors.New("expected ack message was not received on close")
ErrExpectedAckWasNotReceivedOnClose signals that the acknowledgment message was not received at close
var ErrInvalidWebSocketHostMode = errors.New("invalid web socket host mode")
ErrInvalidWebSocketHostMode signals that the provided mode is invalid
var ErrNilMarshaller = errors.New("nil marshaller")
ErrNilMarshaller signals that a nil marshaller has been provided
var ErrNilPayloadConverter = errors.New("nil payload converter provided")
ErrNilPayloadConverter signals that a nil payload converter has been provided
var ErrNilPayloadProcessor = errors.New("nil payload processor provided")
ErrNilPayloadProcessor signals that a nil payload processor has been provided
var ErrNoClientsConnected = errors.New("no client connected")
ErrNoClientsConnected is an error signal indicating the absence of any connected clients
var ErrServerIsClosed = errors.New("http: Server closed")
ErrServerIsClosed represents the error thrown by the server's ListenAndServe() function when the server is closed
var ErrZeroValueAckTimeout = errors.New("zero value provided for acknowledge timeout")
ErrZeroValueAckTimeout signals that a zero value for acknowledge timeout has been provided
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) GetCounter ¶
func (*WsMessage) GetPayload ¶
func (*WsMessage) GetVersion ¶ added in v0.0.2
func (*WsMessage) GetWithAcknowledge ¶
func (*WsMessage) MarshalToSizedBuffer ¶
func (*WsMessage) ProtoMessage ¶
func (*WsMessage) ProtoMessage()
func (*WsMessage) XXX_DiscardUnknown ¶
func (m *WsMessage) XXX_DiscardUnknown()