driver

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package driver provides the default driver of zerobot

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WSClient

type WSClient struct {
	Url         string // ws连接地址
	AccessToken string
	// contains filtered or unexported fields
}

WSClient ...

func NewWebSocketClient

func NewWebSocketClient(url, accessToken string) *WSClient

NewWebSocketClient 默认Driver,使用正向WS通信

func (*WSClient) CallApi

func (ws *WSClient) CallApi(req zero.APIRequest) (zero.APIResponse, error)

CallApi 发送ws请求

func (*WSClient) Connect

func (ws *WSClient) Connect()

Connect 连接ws服务端

func (*WSClient) Listen

func (ws *WSClient) Listen(handler func([]byte, zero.APICaller))

Listen 开始监听事件

type WSSCaller

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

WSSCaller ...

func (*WSSCaller) CallApi

func (wssc *WSSCaller) CallApi(req zero.APIRequest) (zero.APIResponse, error)

CallApi 发送ws请求

type WSServer

type WSServer struct {
	Url         string // ws连接地址
	AccessToken string

	json.Unmarshaler
	// contains filtered or unexported fields
}

WSServer ...

func NewWebSocketServer

func NewWebSocketServer(waitn int, url, accessToken string) *WSServer

NewWebSocketServer 使用反向WS通信

func (*WSServer) Connect

func (wss *WSServer) Connect()

Connect 监听ws服务

func (*WSServer) Listen

func (wss *WSServer) Listen(handler func([]byte, zero.APICaller))

Listen 开始监听事件

func (*WSServer) UnmarshalJSON

func (wss *WSServer) UnmarshalJSON(data []byte) error

UnmarshalJSON init WSServer with waitn=16

Jump to

Keyboard shortcuts

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