virtual_room

package module
v0.0.0-...-9c17813 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: MIT Imports: 5 Imported by: 0

README

virtual_room

事件->创建Hub->Hub中添加Client

Client

client中包括心跳检测,可receive来自Hub的事件也可推送事件到Hubbroadcast

Hub

Hub中包含cron, broadcast, clients

Documentation

Overview

2021-10-21: go get github.com/robfig/cron/v3@v3.0.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCron

func NewCron() *cron.Cron

func ServeEvent

func ServeEvent(hub *Hub, name string, event string, info Object)

ServeEvent handles Event from the peer.

Types

type Client

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

Client is a middleman between the websocket connection and the hub.

type Hub

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

func NewHub

func NewHub() *Hub

func (*Hub) Run

func (h *Hub) Run()

type Object

type Object struct {
	ID   string
	Name string
}

type SingleList

type SingleList struct {
	Head *SingleNode
	Tail *SingleNode
	Size uint
	// contains filtered or unexported fields
}

单链表

func (*SingleList) Append

func (list *SingleList) Append(node *SingleNode) bool

添加节点到链表尾部

func (*SingleList) Delete

func (list *SingleList) Delete(index uint) bool

删除指定位置的节点

func (*SingleList) Display

func (list *SingleList) Display()

输出链表

func (*SingleList) Get

func (list *SingleList) Get(index uint) *SingleNode

获取指定位置的节点,不存在则返回nil

func (*SingleList) Init

func (list *SingleList) Init()

初始化

func (*SingleList) Insert

func (list *SingleList) Insert(index uint, node *SingleNode) bool

插入节点到指定位置

type SingleNode

type SingleNode struct {
	Data singleObject
	Next *SingleNode
}

单链表节点

type Stack

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

栈信息

func NewStack

func NewStack() *Stack

func (*Stack) Init

func (s *Stack) Init()

Init 初始化栈

func (*Stack) Peek

func (s *Stack) Peek() interface{}

Peek 查看栈顶元素

func (*Stack) Pop

func (s *Stack) Pop() interface{}

Pop 压出栈

func (*Stack) Push

func (s *Stack) Push(data interface{}) bool

Push 压入栈

func (*Stack) Size

func (s *Stack) Size() uint

Size 获取栈的长度

Jump to

Keyboard shortcuts

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