connect

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connect

type Connect struct {
	ID string

	Host    string
	Uri     string
	Headers map[string]string
	// contains filtered or unexported fields
}

func New

func New(

	listener net.Listener,
	poller netpoll.Poller,
	pool *pond.WorkerPool,

	readBufferSize int,
	writeBufferSize int,
	protocol func([]byte) bool,
	protocolCustom func([]byte) (string, bool),
	extension func(httphead.Option) bool,
	extensionCustom func([]byte, []httphead.Option) ([]httphead.Option, bool),
	negotiate func(httphead.Option) (httphead.Option, error),
	header ws.HandshakeHeader,

	eventsCors *[]func(origin string) (err error),
	eventsConnect *[]func(cn *Connect) (err error),

) (*Connect, error)

func (*Connect) Close

func (conn *Connect) Close()

func (*Connect) Event

func (conn *Connect) Event(callback func(ev netpoll.Event))

func (*Connect) Read added in v0.0.2

func (conn *Connect) Read() (*Decoding, error)

func (*Connect) Send

func (conn *Connect) Send(id int, event string, data interface{}) error

type Decoding

type Decoding struct {
	ID    int             `json:"id"`
	Type  string          `json:"type"`
	Value json.RawMessage `json:"value"`
}

func (*Decoding) UnmarshalJSON added in v0.0.2

func (r *Decoding) UnmarshalJSON(p []byte) error

type Encoding

type Encoding struct {
	ID    int         `json:"id"`
	Type  string      `json:"type"`
	Value interface{} `json:"value"`
}

Jump to

Keyboard shortcuts

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