connection

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Listener

type Listener struct {
	OnStatusChange func(status Status)
	OnReceive      func(frame model.Frame)
	OnError        func(err error)
}

type SocketConnection

type SocketConnection interface {
	AddListener(listener Listener)
	GetConnectionState() Status
	SetConnectionStatus(status Status)
	Close(ex error) (err error)
	Send(frame model.Frame) error
	// contains filtered or unexported methods
}

func NewTcpConnection

func NewTcpConnection(options TcpOpts, codecImpl codec.Codec) SocketConnection

type Status

type Status string
const (
	CLOSED       Status = "CLOSED"
	CONNECTED    Status = "CONNECTED"
	CONNECTING   Status = "CONNECTING"
	NotConnected Status = "NOT_CONNECTED"
	ERROR        Status = "ERROR"
)

type TcpConnection

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

func (TcpConnection) AddListener

func (conn TcpConnection) AddListener(listener Listener)

func (TcpConnection) Close

func (conn TcpConnection) Close(ex error) (err error)

func (*TcpConnection) Connect

func (conn *TcpConnection) Connect() error

func (TcpConnection) GetConnectionState

func (conn TcpConnection) GetConnectionState() Status

func (TcpConnection) Send

func (conn TcpConnection) Send(frame model.Frame) error

func (TcpConnection) SetConnectionStatus

func (conn TcpConnection) SetConnectionStatus(status Status)

type TcpOpts added in v0.4.0

type TcpOpts struct {
	Host string `json:"host"`
}

Jump to

Keyboard shortcuts

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