websocket

package module
v0.0.0-...-d2f45f1 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: MIT Imports: 6 Imported by: 1

Documentation

Overview

Package websocket implements the WebSocket connector.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	MsgType int
	Payload []byte
}

Message represents a WebSocket message container. Message types are defined in RFC 6455, section 11.8.

type Sink

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

Sink represents a WebSocket sink connector.

func NewSink

func NewSink(url string, logger *slog.Logger) (*Sink, error)

NewSink creates and returns a new Sink using the default dialer.

func NewSinkWithDialer

func NewSinkWithDialer(url string, dialer *ws.Dialer, logger *slog.Logger) (*Sink, error)

NewSinkWithDialer returns a new Sink using the specified dialer.

func (*Sink) In

func (wsock *Sink) In() chan<- any

In returns the input channel of the Sink connector.

type Source

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

Source represents a WebSocket source connector.

func NewSource

func NewSource(ctx context.Context, url string, logger *slog.Logger) (*Source, error)

NewSource creates and returns a new Source using the default dialer.

func NewSourceWithDialer

func NewSourceWithDialer(ctx context.Context, url string,
	dialer *ws.Dialer, logger *slog.Logger) (*Source, error)

NewSourceWithDialer returns a new Source using the specified dialer.

func (*Source) Out

func (wsock *Source) Out() <-chan any

Out returns the output channel of the Source connector.

func (*Source) Via

func (wsock *Source) Via(operator streams.Flow) streams.Flow

Via streams data to a specified operator and returns it.

Jump to

Keyboard shortcuts

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