handle

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientBroadcastEvent added in v0.1.0

func ClientBroadcastEvent(trigger *Handler, targets []interface{}, uuid string, data string)

func ClientBroadcastEventCallback added in v0.1.0

func ClientBroadcastEventCallback(trigger *Handler, target interface{}, uuid string, data string)

func ClientOnlineStatusChangeEvent added in v0.1.0

func ClientOnlineStatusChangeEvent(trigger *Handler, online bool)

func ConfigureRAWClientHandler added in v0.2.5

func ConfigureRAWClientHandler(c *ReadThenWriteClient)

ConfigureRAWClientHandler configure and link handler to connection

func ConfigureRWWClientHandler added in v0.2.5

func ConfigureRWWClientHandler(c *ReadWithWriteClient)

ConfigureRWWClientHandler configure and link handler to connection

func CreateNTQQWebSocket

func CreateNTQQWebSocket() error

func CreateWSInstance

func CreateWSInstance(port int)

CreateWSInstance create new ws instance and wait client connection

func EnableHttpService added in v0.1.0

func EnableHttpService(port int)

EnableHttpService enable http server

func GetOnlineClients added in v0.1.0

func GetOnlineClients(ctx *gin.Context)

GetOnlineClients get online clients array

func GetWebSocketPort added in v0.1.0

func GetWebSocketPort(ctx *gin.Context)

GetWebSocketPort get available ws port

func Init

func Init()

func TryPostHttp added in v0.2.5

func TryPostHttp(postUrl string, secret string) error

func TryReverseWebsocket added in v0.2.5

func TryReverseWebsocket(wsUrl string, accessToken string) error

TryReverseWebsocket try to establish reverse ws client connection

func TryTouchEnhanceHook added in v0.1.0

func TryTouchEnhanceHook(msgData global.MsgData, handler *Handler) (global.MsgData, bool, error)

TryTouchEnhanceHook check and handle api if exists @return data, exist, error

Types

type Cache

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

func NewCache

func NewCache(expireTime time.Duration) *Cache

func (*Cache) Append

func (c *Cache) Append(data global.MsgData) (string, error)

type Client added in v0.2.5

type Client interface {
	// contains filtered or unexported methods
}

type EchoMap

type EchoMap struct {
	Receive chan bool
	// contains filtered or unexported fields
}

EchoMap 利用 echo 完成 NTQQ -> client 消息调度 (发送时标记echo)

func NewEchoMap

func NewEchoMap() *EchoMap

func (*EchoMap) JustGet

func (em *EchoMap) JustGet(id string, consumer func(global.MsgData))

func (*EchoMap) JustPut

func (em *EchoMap) JustPut(id string, data global.MsgData)

JustPut echo

type Handler

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

func FindHandler

func FindHandler(id string) *Handler

func NewHandler

func NewHandler(ctx context.Context) *Handler

func (*Handler) AddMessage

func (h *Handler) AddMessage(uuid string)

func (*Handler) AddWait

func (h *Handler) AddWait()

AddWait 添加任务协程数

func (*Handler) GetId

func (h *Handler) GetId() string

func (*Handler) GetMessage

func (h *Handler) GetMessage(consumer func(data global.MsgData))

GetMessage from local cache

func (*Handler) GetName added in v0.1.0

func (h *Handler) GetName() string

func (*Handler) ShouldExit

func (h *Handler) ShouldExit() bool

ShouldExit 是否需要结束

func (*Handler) WaitDone

func (h *Handler) WaitDone()

WaitDone 等待任务结束

func (*Handler) WaitExitAll

func (h *Handler) WaitExitAll()

WaitExitAll 结束所有等待

type ReadThenWriteClient added in v0.2.5

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

ReadThenWriteClient read loop and write loop

func NewReadThenWriteClient added in v0.2.5

func NewReadThenWriteClient(conn *websocket.Conn, handler *Handler) *ReadThenWriteClient

type ReadWithWriteClient added in v0.2.5

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

ReadWithWriteClient read loop with write loop

func NewReadWithWriteClient added in v0.2.5

func NewReadWithWriteClient(url string, secret string, handler *Handler) *ReadWithWriteClient

Jump to

Keyboard shortcuts

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