gateway

package
v2.0.0-...-70fcb0c Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	URL          string
	Dialer       *websocket.Dialer
	PingInterval time.Duration
}

func DefaultConfig

func DefaultConfig() *Config

func (*Config) Apply

func (c *Config) Apply(opts []ConfigOpt)

type ConfigOpt

type ConfigOpt func(config *Config)

func WithDialer

func WithDialer(dialer *websocket.Dialer) ConfigOpt

func WithPingInterval

func WithPingInterval(interval time.Duration) ConfigOpt

func WithURL

func WithURL(url string) ConfigOpt

type EventHandlerFunc

type EventHandlerFunc func(gatewayEventType pandemonium.OpcodeType, event any)

type Gateway

type Gateway interface {
	Connect(ctx context.Context) error
	Close(ctx context.Context)
	CloseWithCode(ctx context.Context, code int, message string)
	Send(ctx context.Context, op pandemonium.OpcodeType, data any) error
	Latency() time.Duration
}

Gateway connects to the Eludris websocket gateway (pandemonium).

func New

func New(eventHandlerFunc EventHandlerFunc, opts ...ConfigOpt) Gateway

type Payload

type Payload struct {
	Op pandemonium.OpcodeType `json:"op"`
	D  any                    `json:"d,omitempty"`
}

func (*Payload) UnmarshalJSON

func (p *Payload) UnmarshalJSON(data []byte) error

type PayloadDataUnknown

type PayloadDataUnknown json.RawMessage

Jump to

Keyboard shortcuts

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