client

package
v0.0.0-...-2d539fd Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const SessionExpiryDuration = 15 * time.Minute

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Session    *Session
	LastActive time.Time
	// contains filtered or unexported fields
}

func NewClient

func NewClient(ctx context.Context, conn *websocket.Conn, upgrader *websocket.Upgrader) *Client

func (*Client) Conn

func (c *Client) Conn() *websocket.Conn

func (*Client) Context

func (c *Client) Context() context.Context

func (*Client) Disconnect

func (c *Client) Disconnect()

func (*Client) Dispatch

func (c *Client) Dispatch(msg *dispatcher.Message)

func (*Client) Send

func (c *Client) Send(op opcode.Opcode, data interface{}) error

func (*Client) Write

func (c *Client) Write(packet resource.Packet) error

type Session

type Session struct {
	Id     string        `json:"id" redis:"id"`
	UserId model.UserId  `json:"user_id" redis:"user_id"`
	RoomId model.RoomId  `json:"room_id" redis:"room_id"`
	NodeId string        `json:"node_id" redis:"node_id"`
	Roles  *role.Manager `json:"-" redis:"-"`
}

func NewSession

func NewSession(userId model.UserId, nodeId string) *Session

func (*Session) HasPermission

func (s *Session) HasPermission(perm permission.Permission) bool

Jump to

Keyboard shortcuts

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