client

package
Version: v0.0.0-...-ed4ccba Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type After

type After func(client *Client, stream *socket.Stream) error

type Async

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

func (*Async) Emit

func (a *Async) Emit(pack socket.Pack) (*socket.Stream, error)

func (*Async) JsonEmit

func (a *Async) JsonEmit(pack socket.JsonPack) (*socket.Stream, error)

func (*Async) ProtoBufEmit

func (a *Async) ProtoBufEmit(pack socket.ProtoBufPack) (*socket.Stream, error)

type Before

type Before func(client *Client, stream *socket.Stream) error

type Client

type Client struct {
	Name string
	Addr string

	Conn *net.UDPConn
	// AutoHeartBeat     bool
	HeartBeatTimeout  time.Duration
	HeartBeatInterval time.Duration
	HeartBeat         func(c *Client) error
	// Reconnect         bool
	ReconnectInterval time.Duration
	ReadBufferSize    int
	WriteBufferSize   int
	DailTimeout       time.Duration

	OnOpen         func(client *Client)
	OnClose        func(client *Client)
	OnMessage      func(client *Client, msg []byte)
	OnError        func(err error)
	OnSuccess      func()
	OnReconnecting func()
	OnUnknown      func(client *Client, message []byte, next Middle)

	PingHandler func(client *Client) func(appData string) error
	PongHandler func(client *Client) func(appData string) error

	Protocol udp.Protocol
	// contains filtered or unexported fields
}

func (*Client) Async

func (c *Client) Async() *Async

func (*Client) Close

func (c *Client) Close() error

func (*Client) Connect

func (c *Client) Connect()

func (*Client) Emit

func (c *Client) Emit(pack socket.Pack) error

func (*Client) GetRouter

func (c *Client) GetRouter() *Router

func (*Client) JsonEmit

func (c *Client) JsonEmit(pack socket.JsonPack) error

func (*Client) LocalAddr

func (c *Client) LocalAddr() net.Addr

func (*Client) ProtoBufEmit

func (c *Client) ProtoBufEmit(pack socket.ProtoBufPack) error

func (*Client) Push

func (c *Client) Push(message []byte) error

func (*Client) RemoteAddr

func (c *Client) RemoteAddr() net.Addr

func (*Client) SetRouter

func (c *Client) SetRouter(router *Router) *Client

func (*Client) Use

func (c *Client) Use(middle ...func(Middle) Middle)

func (*Client) WriteToUDP

func (c *Client) WriteToUDP(message []byte, addr *net.UDPAddr) error

type Middle

type Middle func(client *Client, stream *socket.Stream)

type RouteHandler

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

func (*RouteHandler) Remove

func (rh *RouteHandler) Remove(path string)

func (*RouteHandler) Route

func (rh *RouteHandler) Route(path string) *route

type Router

type Router struct {
	IgnoreCase bool
	// contains filtered or unexported fields
}

func (*Router) GetAllRouters

func (r *Router) GetAllRouters() []*node

func (*Router) Group

func (r *Router) Group(path ...string) *group

func (*Router) Remove

func (r *Router) Remove(path ...string)

func (*Router) Route

func (r *Router) Route(path string) *route

func (*Router) SetGlobalAfter

func (r *Router) SetGlobalAfter(after ...After)

func (*Router) SetGlobalBefore

func (r *Router) SetGlobalBefore(before ...Before)

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