client

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Unknown      = 0
	Connecting   = 1
	Connected    = 2
	Disconnected = 3
)

Variables

This section is empty.

Functions

func CloseClient added in v0.4.0

func CloseClient(client *Client)

Types

type Client

type Client struct {
	Id        string
	SessionId string

	Conn net.Conn

	LastPingTime  time.Time
	ConnectedTime time.Time
	CleanSession  bool
	Keepalive     uint16
	// contains filtered or unexported fields
}

func FindClientsBySessionIds added in v0.4.0

func FindClientsBySessionIds(sessionIds []string) []*Client

func NewClient

func NewClient(cp *packets.ConnectPacket, conn net.Conn, authentication *security.Authentication, serverConfig *config.ServerConfig) (*Client, bool)

func (*Client) CanPub added in v0.3.0

func (client *Client) CanPub(topic string) bool

该方法会对pubAuthCache进行读写,需要确保非并发调用(使用map是为了提高性能)

func (*Client) CanSub added in v0.3.0

func (client *Client) CanSub(topic string) bool

func (*Client) IsConnected

func (client *Client) IsConnected() bool

func (*Client) Touch

func (client *Client) Touch()

type Session added in v0.4.0

type Session struct {
	Id       string
	ClientId string
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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