channel

package
v0.0.0-...-5349944 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 单位: ms
	DEFAULT_TIMEOUT = 10000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiChannel

type ApiChannel interface {
	Post(url string) error
	PostForResult(url string, result interface{}) error
	PostByRequest(url string, req interface{}) error
	PostByRequestForResult(url string, req, result interface{}) error
}

func NewApiChannel

func NewApiChannel(conf *config.OnebotApiConfig) (ApiChannel, error)

func NewHttpApiChannel

func NewHttpApiChannel(conf *config.OnebotApiConfig) (ApiChannel, error)

func NewWebsocketApiChannel

func NewWebsocketApiChannel(conf *config.OnebotApiConfig) (ApiChannel, error)

func NewWebsocketReverseApiChannel

func NewWebsocketReverseApiChannel(conf *config.OnebotApiConfig) (ApiChannel, error)

type EventChannel

type EventChannel interface {
	StartListen(context.Context, func(message []byte) error) error
}

func NewEventChannel

func NewEventChannel(conf *config.OnebotEventConfig) (EventChannel, error)

func NewHttpReverseEventChannel

func NewHttpReverseEventChannel(conf *config.OnebotEventConfig) (EventChannel, error)

func NewWebsocketEventChannel

func NewWebsocketEventChannel(conf *config.OnebotEventConfig) (EventChannel, error)

func NewWebsocketReverseEventChannel

func NewWebsocketReverseEventChannel(conf *config.OnebotEventConfig) (EventChannel, error)

type HttpChannel

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

func (*HttpChannel) Post

func (c *HttpChannel) Post(url string) error

func (*HttpChannel) PostByRequest

func (c *HttpChannel) PostByRequest(url string, req interface{}) error

func (*HttpChannel) PostByRequestForResult

func (c *HttpChannel) PostByRequestForResult(url string, req, result interface{}) error

func (*HttpChannel) PostForResult

func (c *HttpChannel) PostForResult(url string, result interface{}) error

type HttpReverseEventChannel

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

func (*HttpReverseEventChannel) StartListen

func (cli *HttpReverseEventChannel) StartListen(ctx context.Context, handler func(message []byte) error) error

type WebsocketApiChannel

type WebsocketApiChannel struct {
	Ctx context.Context

	Conn *websocket.Conn
	// contains filtered or unexported fields
}

func (*WebsocketApiChannel) Listen

func (cli *WebsocketApiChannel) Listen(ctx context.Context, callback func(message []byte) error) error

func (*WebsocketApiChannel) Post

func (cli *WebsocketApiChannel) Post(action string) error

func (*WebsocketApiChannel) PostByRequest

func (cli *WebsocketApiChannel) PostByRequest(action string, params interface{}) error

func (*WebsocketApiChannel) PostByRequestForResult

func (cli *WebsocketApiChannel) PostByRequestForResult(action string, params interface{}, result interface{}) error

func (*WebsocketApiChannel) PostForResult

func (cli *WebsocketApiChannel) PostForResult(action string, result interface{}) error

type WebsocketEventChannel

type WebsocketEventChannel struct {
	Conn *websocket.Conn
	// contains filtered or unexported fields
}

func (*WebsocketEventChannel) StartListen

func (cli *WebsocketEventChannel) StartListen(ctx context.Context, callback func(message []byte) error) error

type WebsocketReverseApiChannel

type WebsocketReverseApiChannel struct {
	Ctx  context.Context
	Conn *websocket.Conn
	// contains filtered or unexported fields
}

func (*WebsocketReverseApiChannel) Post

func (cli *WebsocketReverseApiChannel) Post(action string) error

func (*WebsocketReverseApiChannel) PostByRequest

func (cli *WebsocketReverseApiChannel) PostByRequest(action string, params interface{}) error

func (*WebsocketReverseApiChannel) PostByRequestForResult

func (cli *WebsocketReverseApiChannel) PostByRequestForResult(action string, params interface{}, result interface{}) error

func (*WebsocketReverseApiChannel) PostForResult

func (cli *WebsocketReverseApiChannel) PostForResult(action string, result interface{}) error

type WebsocketReverseEventChannel

type WebsocketReverseEventChannel struct {
	Conn *websocket.Conn
	// contains filtered or unexported fields
}

func (*WebsocketReverseEventChannel) StartListen

func (ws *WebsocketReverseEventChannel) StartListen(ctx context.Context, handler func(message []byte) error) error

Jump to

Keyboard shortcuts

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