websocket

package
v0.0.0-...-e7f8777 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(id, name string, lg *zap.Logger, opts ClientOptions) qim.Client

func NewClientWithProps

func NewClientWithProps(id, name string, meta map[string]string, lg *zap.Logger, opts ClientOptions) qim.Client

func NewConn

func NewConn(conn net.Conn) qim.Conn

func NewServer

func NewServer(listen string, service qim.ServiceRegistration, options ...qim.ServerOption) qim.Server

Types

type Client

type Client struct {
	sync.Mutex
	qim.Dialer
	// contains filtered or unexported fields
}

func (*Client) Close

func (c *Client) Close()

Close implements qim.Client

func (*Client) Connect

func (c *Client) Connect(addr string) error

Connect implements qim.Client

func (*Client) GetMeta

func (c *Client) GetMeta() map[string]string

GetMeta implements qim.Client

func (*Client) Read

func (c *Client) Read() (qim.Frame, error)

Read implements qim.Client Read a frame, this function is not safety for concurrent

func (*Client) Send

func (c *Client) Send(payload []byte) error

Send implements qim.Client

func (*Client) ServiceID

func (c *Client) ServiceID() string

ServiceID implements qim.Client

func (*Client) ServiceName

func (c *Client) ServiceName() string

ServiceName implements qim.Client

func (*Client) SetDialer

func (c *Client) SetDialer(dialer qim.Dialer)

SetDialer implements qim.Client

type ClientOptions

type ClientOptions struct {
	Heartbeat time.Duration
	Readwait  time.Duration
	Writewait time.Duration
}

type Frame

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

func (*Frame) GetOpCode

func (f *Frame) GetOpCode() qim.OpCode

GetOpCode implements qim.Frame

func (*Frame) GetPayload

func (f *Frame) GetPayload() []byte

GetPayload implements qim.Frame

func (*Frame) SetOpCode

func (f *Frame) SetOpCode(opcode qim.OpCode)

SetOpCode implements qim.Frame

func (*Frame) SetPayload

func (f *Frame) SetPayload(payload []byte)

SetPayload implements qim.Frame

type Upgrader

type Upgrader struct {
}

func (*Upgrader) Name

func (u *Upgrader) Name() string

func (*Upgrader) Upgrade

func (u *Upgrader) Upgrade(rawconn net.Conn, rd *bufio.Reader, wr *bufio.Writer) (qim.Conn, error)

type WsConn

type WsConn struct {
	net.Conn
	// contains filtered or unexported fields
}

func NewConnWithRW

func NewConnWithRW(conn net.Conn, rd *bufio.Reader, wr *bufio.Writer) *WsConn

func (*WsConn) Flush

func (c *WsConn) Flush() error

Flush implements qim.Conn

func (*WsConn) ReadFrame

func (c *WsConn) ReadFrame() (qim.Frame, error)

ReadFrame implements qim.Conn

func (*WsConn) WriteFrame

func (c *WsConn) WriteFrame(opcode qim.OpCode, payload []byte) error

WriteFrame implements qim.Conn

Jump to

Keyboard shortcuts

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