Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrClosed = errors.New("socket closed")
var ErrTimeout = errors.New("socket timeout")
Timeout error
Functions ¶
This section is empty.
Types ¶
type FrameHandshake ¶ added in v1.9.0
type FrameHandshake struct { Trans TransportMsg // contains filtered or unexported fields }
FrameHandshake represents a stream with message semantics
func NewFrameHandshakeFromTransport ¶ added in v1.9.0
func NewFrameHandshakeFromTransport(t TransportMsg) *FrameHandshake
NewFrameHandshakeFromTransport creates a message stream from transport t
func (*FrameHandshake) Close ¶ added in v1.9.0
func (fh *FrameHandshake) Close() error
Close closes the transport stream
func (*FrameHandshake) ReadMsg ¶ added in v1.9.0
func (fh *FrameHandshake) ReadMsg(timeout time.Duration) ([]byte, error)
ReadMsg reads a io4edge standard message from transport without timeout
func (*FrameHandshake) WriteMsg ¶ added in v1.9.0
func (fh *FrameHandshake) WriteMsg(payload []byte) error
WriteMsg writes io4edge standard message to the transport stream
type FramedStream ¶
type FramedStream struct { Trans Transport // contains filtered or unexported fields }
FramedStream represents a stream with message semantics
func NewFramedStreamFromTransport ¶
func NewFramedStreamFromTransport(t Transport) *FramedStream
NewFramedStreamFromTransport creates a message stream from transport t
func (*FramedStream) Close ¶
func (fs *FramedStream) Close() error
Close closes the transport stream
func (*FramedStream) ReadMsg ¶
func (fs *FramedStream) ReadMsg(timeout time.Duration) ([]byte, error)
ReadMsg reads a io4edge standard message from transport stream
func (*FramedStream) WriteMsg ¶
func (fs *FramedStream) WriteMsg(payload []byte) error
WriteMsg writes io4edge standard message to the transport stream
type MsgStream ¶
type MsgStream interface { ReadMsg(timeout time.Duration) ([]byte, error) WriteMsg(payload []byte) (err error) Close() error }
MsgStream is the interface used by a Channel to exchange message frames with the transport layer e.g. socket, websocket...
type Transport ¶
type Transport interface { Read(p []byte) (n int, err error) Write(p []byte) (n int, err error) SetReadDeadline(t time.Time) error Close() error }
Transport is the interface used by message stream to communicate with the underlying transport layer e.g. tcp sockets
type TransportMsg ¶ added in v1.9.0
type TransportMsg interface { Read(p []byte) (n int, err error) Write(p []byte) (n int, err error) SetReadDeadline(t time.Time) error Close() error }
TransportMsg is the interface used by message stream to communicate with the underlying transport layer e.g. udp sockets