Version: v0.0.0-...-0c79dac Latest Latest

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

Go to latest
Published: Sep 15, 2021 License: Apache-2.0 Imports: 12 Imported by: 0




This section is empty.


This section is empty.


func NewClient

func NewClient(id, name string, opts ClientOptions) kim.Client

NewClient NewClient

func NewClientWithProps

func NewClientWithProps(id, name string, meta map[string]string, opts ClientOptions) kim.Client

func NewConn

func NewConn(conn net.Conn) kim.Conn

func NewServer

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

NewServer NewServer


type Client

type Client struct {

	Meta map[string]string
	// contains filtered or unexported fields

Client is a websocket implement of the terminal

func (*Client) Close

func (c *Client) Close()

Close 关闭

func (*Client) Connect

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

Connect to server

func (*Client) GetMeta

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

func (*Client) Read

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

Read a frame ,this function is not safey for concurrent

func (*Client) Send

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

Send data to connection

func (*Client) ServiceID

func (c *Client) ServiceID() string

ID return id

func (*Client) ServiceName

func (c *Client) ServiceName() string

Name Name

func (*Client) SetDialer

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

SetDialer 设置握手逻辑

type ClientOptions

type ClientOptions struct {
	Heartbeat time.Duration //登录超时
	ReadWait  time.Duration //读超时
	WriteWait time.Duration //写超时

ClientOptions ClientOptions

type Frame

type Frame struct {
	// contains filtered or unexported fields

func (*Frame) GetOpCode

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

func (*Frame) GetPayload

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

func (*Frame) SetOpCode

func (f *Frame) SetOpCode(code kim.OpCode)

func (*Frame) SetPayload

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

type Upgrader

type Upgrader struct {

Server is a websocket implement of the Server

func (*Upgrader) Name

func (u *Upgrader) Name() string

func (*Upgrader) Upgrade

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

type WsConn

type WsConn struct {
	// 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

func (*WsConn) ReadFrame

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

func (*WsConn) WriteFrame

func (c *WsConn) WriteFrame(code kim.OpCode, payload []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL